let function

Bergi a.d.bergi at web.de
Thu May 14 19:25:09 UTC 2015

Alexander Jones schrieb:
 > On Thursday, May 14, 2015, Domenic Denicola <d at domenic.me> wrote:
 >>   They can, in fact, be scoped in a for loop.
> That's not what I see, in strict mode at least, which I assume most people
> consider de facto by now!
> From V8:
>      SyntaxError: In strict mode code, functions can only be declared at top
> level or immediately within another function.

That's ES5. In ES6, function declarations are allowed in blocks - with 
the new block scope semantics. This was only possible as ES5 strict mode 
held that spot open so now it doesn't break anything :-)
Yes, it will need a while until people get accustomed to that.


More information about the es-discuss mailing list