It has come to my understanding that in ECMAScript 5, octal literals (such as 023) are considered invalid although widely supported. However, ECMAScript 6 introduced support for them in the form of 0o23 or 0O23. What puzzles me is how numbers that are not valid octals but have a leading zero (like 019) behave - they seem to act as regular decimal numbers.
For example, without strict mode, expressions like 022 === 018 evaluate to true because 022 is interpreted as an octal number while 018 is assumed to be decimal since it does not meet octal criteria.
In contrast, when using strict mode, an error occurs when dealing with a valid octal number using this format (e.g., 022), but no error arises when employing a zero-prefixed number that cannot be an octal number (e.g., 018).
This behavior appears quite peculiar to me. It almost seems like JS (strict-mode) is allowing a 0 before the number as long as it isn't a valid octal. In versions beyond ES6, will zero-prefixed numbers (potentially octals or otherwise) be deemed invalid or treated as decimals?