79225200

Date: 2024-11-26 03:09:55
Score: 1
Natty:
Report link

Here is the key: octal.

Yes, I agree with you, it is weird. But… this is what it is. Let's see:

The reason is that in the past (I think, as early as in ECMAScript 3), the leading zero was interpreted as a prefix to indicate an octal number. Later on, to avoid confusion, they decided to ban this form of literal in strict mode and show the syntax error you observed.

The modern octal literal syntax is using the Latin letter ‘o’ (‘O’), so the prefix is ‘0o’ or ‘0O’. Please see, for example, https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Deprecated_octal_literal.

Reasons:
  • No code block (0.5):
  • Low reputation (0.5):
Posted by: Sergey A Kryukov