re: 🤔Pop Quiz! Which of these is an infinite loop? VIEW POST

re: Ha! That's a great illustration for why let is better than var :) I actually did have a case where I had to use var once - but it was a really obs...

I still have one use case for var - a browser's developer tools.
Often I need to quickly test an idea and I write
var foo = 'bar'
then after some thoughts I press arrow up on keyboard and change previous input to
var foo = 'baz'

With let I get Uncaught SyntaxError: Identifier 'foo' has already been declared and it always frustrating 😐


Oh yea, I use var in console for the same reason!

Code of Conduct Report abuse