DEV Community

Discussion on: Stop using var for declaring variables !!!

 
lionelrowe profile image
lionel-rowe • Edited
var strings = [
    'Sometimes,',
    '`var` is best,',
    'whereas other times,',
    '`let` is best.',
]

for (var [idx, str] of strings.entries()) {
    setTimeout(() => console.log(str), idx * 1000)
}
Enter fullscreen mode Exit fullscreen mode

😉