for(var i=0;i<5;i++){
setTimeout(function(){
console.log(i);
},0);
}
Answer
55555: Output is 5 five times, because setTimeout is executing after loop is over (setTimeout callback is executing in browser Task Queue)
for(var i=0;i<5;i++){
setTimeout(function(){
console.log(i);
},0);
}