Junior — Senior
var effect and deferred call in a loop
livecode
Task condition
Determine what result will be printed to the console after executing this code fragment, considering the scope features of the variable declared with var, and the asynchronous nature of the setTimeout function.
for (var index = 1; index <= 5; index++) {
setTimeout(function() {
console.log(index);
}, 0);
}