Integer literals starting with a zero are octal rather than decimal values. While using octal values is fully supported, most developers do not
have experience with them. They may not recognize octal values as such, mistaking them instead for decimal values.
Additionally, these literals will throw SyntaxError in strict mode. 0-prefixed octal literals have been deprecated since ECMAScript 5 and should
not be used in modern JavaScript code.
const myNumber = 010; // Noncompliant: Deprecated format
Use decimal syntax when possible as it is more readable.
const myNumber = 8;
If octal notation is required, use the standard syntax: a leading zero followed by a lowercase or uppercase Latin letter "O" (0o
or
0O
).
const myNumber = 0o10;