Why are Octal numeric literals not allowed in JavaScript strict mode? What is the harm?
Why is Octal numeric literals not allowed in javascript strict mode? What is the harm?
Octals in JS have historically been a non-standard extension to the standard (in ES5, which introduces strict mode, they're in Annex B, which is a collection of non-standard features that most implementations support: except it defines octals in a way incompatible with what websites require), and strict mode made an attempt to disallow all non-standard extensions. The "why" as to why they were never standardised is an obvious related question, and that I'm unaware of.
In case a developer need to use Octals (which can mistakenly change a number's meaning), is there a work around?
As @Amit answered, parseInt with its second argument as 8 still works in strict mode.