Because it is an Octal Number system if you start with 0
.
and if starts with 0x
it is hexadecimal System.
If you are looking to convert the value to number
, then parseInt
method, accepts the second parameter as radix (the base in mathematical numeral systems)
parseInt( "0123", 8 ); => 83
parseInt( "0123", 10 ); => 123
parseInt( "0123", 16 ); => 291
More from MDN
Integers can be expressed in decimal (base 10), hexadecimal
(base 16), octal (base 8) and binary (base 2).
Decimal integer literal consists of a sequence of digits without a
leading 0 (zero).
Leading 0 (zero) on an integer literal, or leading
0o (or 0O) indicates it is in octal. Octal integers can include only
the digits 0-7.
Leading 0x (or 0X) indicates hexadecimal. Hexadecimal
integers can include digits (0-9) and the letters a-f and A-F.
Leading 0b (or 0B) indicates binary. Binary integers can include digits only 0
and 1.