DEV Community

Discussion on: 🤔Pop Quiz! Which of these is an infinite loop?

Collapse
 
karataev profile image
Eugene Karataev

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 😐

Collapse
 
shiling profile image
Shi Ling

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