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

前端 未结 4 511
攒了一身酷
攒了一身酷 2020-12-03 17:23

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

4条回答
  •  春和景丽
    2020-12-03 17:41

    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);

提交回复
热议问题