DEV Community

Discussion on: JavaScript var vs let. Which one should you use?

Collapse
 
vonheikemen profile image
Heiker

I actually wonder how useful block scoping really is.

I think most problems that people have with var can be solve by being explicit when declaring the variable and using unique names.

Collapse
 
sebbdk profile image
Sebastian Vargr • Edited

This ^

If you have the same variable name in your nested blocks, then likely you are also fudging up the readability, a lot, in my experience.

Which is usually where other problems start...