SyntaxError: "x" is not a legal ECMA-262 octal constant
Warning: SyntaxError: 08 is not a legal ECMA-262 octal constant. Warning: SyntaxError: 09 is not a legal ECMA-262 octal constant.
SyntaxError warning in strict mode only.
What went wrong?
Decimal literals can start with a zero (
0) followed by another decimal digit, but If all digits after the leading
0 are smaller than 8, the number is interpreted as an octal number. Because this is not the case with
Note that octal literals and octal escape sequences are deprecated and will present an additional deprecation warning. With ECMAScript 6 and later, the syntax uses a leading zero followed by a lowercase or uppercase Latin letter "O" (
0O). See the page about lexical grammar for more information.
Invalid octal numbers
08; 09; // SyntaxError: 08 is not a legal ECMA-262 octal constant // SyntaxError: octal literals and octal escape sequences are deprecated
Valid octal numbers
Use a leading zero followed by the letter "o";
© 2016 Mozilla Contributors
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.