I have a piece of javaScript code as :
var val = parseInt("08");
alert("Val : " + val);
It displays val as 0.
Where as the same piece of code in iOS displays 8.
Can someone shed more light on this issue ?
Thanks.
I have a piece of javaScript code as :
var val = parseInt("08");
alert("Val : " + val);
It displays val as 0.
Where as the same piece of code in iOS displays 8.
Can someone shed more light on this issue ?
Thanks.
It's because you are using parseInt without defining which radix to use. Now it thinks you are using 8 as the radix.
Try this:
var val = parseInt('08', 10);