Javascript converting the number to exponential form while using context.getVariable

Not applicable

I have a Javascript policy in which I am accessing a variable as follows

var counter = context.getVariable("Counter")

I am supposed to increment this variable by 1 and set it back into the context, which is then setting the variable into KVMap going forward

However, when I retrieve the variable using the above statement, Apigee converts that number into the exponential form.

For eg., the number is 7589027556679898860, then Apigee converts it into 7.5890275566798991E18. Due to which even if increment the number by one, it does not result into any effect rendering the case useless.

To be more precise, the initial value is stored inside a KVMap, which I access via Javascript and set it back. If there is another way to access the KVMap number, increment it and set it back, it would do to me

0 2 366
2 REPLIES 2

You can use Management API call for this. find it here

@Sonali

I cannot be using API calls. I have to perform this in the API console only.