Why are Octal numeric literals not allowed in strict mode (and what is the workaround?)

Zameer Ansari picture Zameer Ansari · Dec 18, 2015 · Viewed 29.3k times · Source

Why are Octal numeric literals not allowed in JavaScript strict mode? What is the harm?

In case a developer needs to use Octals (which can mistakenly change a numbers meaning), is there a workaround?

Answer

Amit picture Amit · Dec 18, 2015

The "why" part of the question is not really answerable.

As for "how", off the top of my head...

"use strict";
var x = parseInt('010', 8);
document.write(x);