3.1.1 Integer Literals
ues. A hexadecimal literal begins with “0x” or “0X”, followed by a string of hexadecimal
digits. A hexadecimal digit is one of the digits 0 through 9 or the letters a (or A) through
f (or F), which represent values 10 through 15. Here are examples of hexadecimal in-
0xff // 15*16 + 15 = 255 (base 10)
Although the ECMAScript standard does not support them, some implementations of
begins with the digit 0 and is followed by a sequence of digits, each between 0 and 7.
0377 // 3*64 + 7*8 + 7 = 255 (base 10)
Since some implementations support octal literals and some do not, you should never
write an integer literal with a leading zero; you cannot know in this case whether an
implementation will interpret it as an octal or decimal value. In the strict mode of
ECMAScript 5 (§5.7.3), octal literals are explicitly forbidden.