0

Why is escape characters not allowed in javascript strict mode?

"use strict";

var y = \010; //Uncaught SyntaxError: Unexpected token ILLEGAL
<h1>Check browser console for errors</h1>
Zameer Ansari
  • 28,977
  • 24
  • 140
  • 219
  • 1
    Because in general, octals do more harm than good. According to your link, "*Octal syntax isn't part of ECMAScript 5*" in the first place, so browsers are free to not support it... – DCoder Dec 18 '15 at 13:45
  • @DCoder I narrowed the question to escapes only. – Zameer Ansari Dec 18 '15 at 14:58
  • 1
    I'm pretty sure the same reasoning applies as with octal numbers - these days, octal escapes are somewhat exotic. Also, "strict mode" is supposed to be useful, reliable and cross-browser compatible, and formally allowing optional extensions to it would set a bad precedent. But that's just my opinion. Are you asking out of curiosity, or because of a practical problem? – DCoder Dec 18 '15 at 15:59
  • @DCoder I just began learning javascript so it's out of curiosity ;) – Zameer Ansari Dec 18 '15 at 16:03

0 Answers0