Block Scoping in JavaScript
Hey
for(let i = 0; i<3; i++) {
setTimeout(() => {
console.log(i);
})
}
Why this is return 0,1,2 I know If I change let to var this is return 3 times 3. But What is going with let. Actually first time I think every loop time I redeclared but I think this is not true. Someone can explain what is going on here?