In this article we will learn with code example, how to resolve SyntaxError: number is not a legal ECMA-262 octal constant. Octal numbers are in the range 0-7. Any number out of this range like 8 or 9 won’t be an octal digit. Using this will throw Syntax Error.
Also, this way of using octal numbers are deprecated. Use new syntax –
0O followed by octal number.
Code Example –
SyntaxError code –
Correct code –