Skip to content

Latest commit

 

History

History
17 lines (15 loc) · 422 Bytes

README.md

File metadata and controls

17 lines (15 loc) · 422 Bytes

Javascript Job Interview Questions

What Is The Output Of This?

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)

⬅️ BACK