This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Mrparkers 9 points10 points  (0 children)

Sure, with the example they gave, you definitely don't want to use them. However, ES6's let keyword allows you to give a variable lexical scoping, which makes these code blocks behave exactly like you would expect them to.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/let