4 ms·
> Are you supposed to only use let now? Yes, if you can use `let`, there is no reason whatsoever to use `var` ever again. If you want the `var` behavior, just
by ahoge 12y ago
> Are you supposed to only use let now?
Yes, if you can use `let`, there is no reason whatsoever to use `var` ever again.
If you want the `var` behavior, just put your declaration at the very top of the innermost function. With most code conventions, that's where you'd put a `var` declaration anyways.
For what it's worth, Crockford also recommended to use `let` exclusively as soon as you can.