Integer literals starting with the digit 0 may be interpreted as octal numbers by some platforms but not others, and thus should be avoided. This does not make a difference for the literal 0 itself.

If the literal was meant to be octal, convert it to a decimal or hexadecimal number. Otherwise, remove the leading zero.

The following example uses the literal 012, which some platforms will interpret as an octal encoding of the decimal number 10, while others will interpret it as the decimal number 12. Depending on the desired interpretation, it should be replaced with either 10 or 12.

  • Ecma International, ECMAScript Language Definition, 5.1 Edition, Annex B.1.1. ECMA, 2011.