How is let compatibility resolved?

Petka Antonov petka_antonov at hotmail.com
Wed Oct 2 01:45:54 PDT 2013


In current version, this works just fine:

     var let = 6;

That could work with let being a contextual keyword.

But how about:

     var a = 5;
     let(a = 6)
     {
         alert(a)
     }

Currently that does:

     var a = 5;
     a = 6;
     let(6);
     //purposeless block
     {
         alert(a);
     }

But if interpreted in ES6 the meaning changes completely.

The above snippets only cause syntax errors in strict mode but work fine 
in non-strict.

How is this resolved? Will ES6 require some kind of opt-in in a script tag?


More information about the es-discuss mailing list