Re:A summary of ECMAScript 6 features
by tomelders on Sunday February 15, 2015 @04:19AM
(#9052131)
What's the story behind `let` becoming the new `var`? Seems odd to me to change the short hand for "variable" to `let`.
[ Parent
| on HN ]
Re:A summary of ECMAScript 6 features
by ealexhudson on Sunday February 15, 2015 @04:29AM
(#9052151)
`var` is still there, but it is scoped differently - `let` scopes to blocks, e.g. if (foo) { let baz = 'quux'; ... }
`let` in function scope is the same as `var`, in block scope it's narrow, it's basically the thing you want. `var` couldn't change, though, it would have broken existing code - hence `let`/