Hello Guys,
Once I wonder that why the I got the 10 value in my javascript variable x in the following example:
After, googling some times I got that it was a radix param issue [more].
While parsing into the number javascript assumes the following:
Once I wonder that why the I got the 10 value in my javascript variable x in the following example:
var x = 1 + 011;
After, googling some times I got that it was a radix param issue [more].
While parsing into the number javascript assumes the following:
- If the string begins with "0", the javascript consider the string as octal number and convert it to decimal number.
- If the string begins with "0x", the javascript consider the string as hexadecimal number and convert it to decimal number.
- If the string begins with any other value, it will consider as decimal number.
No comments:
Post a Comment