Permalink
Fetching contributors…
Cannot retrieve contributors at this time
19 lines (15 sloc) 428 Bytes
title layout permalink tags
Event Loop - What order do they have
question
event-loop_what-order-do-they-have
intermediate event-loop

In what order will the numbers 1-4 be logged to the console when the code below is executed? Why?

(function() {
    console.log(1); 
    setTimeout(function(){console.log(2)}, 1000); 
    setTimeout(function(){console.log(3)}, 0); 
    console.log(4);
})();