i wrote from 001 to 0010 and much more digit like this that started with "00" in chrome console and Fire Fox even in IE and get this result.
why 0010 is not equal to 10 ? or why 0020 is not equal to 20 ? and it is "16".
A leading zero indicates that a number should be interpreted as octal.
Thus 10
interpreted as octal is equal to 8
in decimal.
For more information refer to MDN on number literals.
"Numeric constants are considered octal if they are preceded by a zero, and are considered hexadecimal if they are preceded by a zero and and x (0x)." (as explained here)
008 is not considered octal because it contains "8" which is not an octal number. 0010 is in fact an octal number and equals 8.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With