4 ms·
What's the story behind `let` becoming the new `var`? Seems odd to me to change the short hand for "variable" to `let`.
by tomelders 12y ago
What's the story behind `let` becoming the new `var`? Seems odd to me to change the short hand for "variable" to `let`.
- oblio 12y agoMath notation, Lisp. These are probably the inspiration for it.
- ealexhudson 12y ago`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`/
- deleted 12y ago[deleted]