4 ms·
That is not at all obvious to many long time JavaScript engineers. Having a variable scoped by block or by function works for me, having both in the language i
by seasoup 11y ago
That is not at all obvious to many long time JavaScript engineers. Having a variable scoped by block or by function works for me, having both in the language is a pain. I have seen some neat tricks that you can do with let in for loops, but nothing that has convinced me it's worth the cognitive overhead of figuring out is this variable a var or a let.
My opinion is that if you use let, don't use var, and if you use var, don't use let. Either one on its own is fine, together they are just a mess.