Answer the question
In order to leave comments, you need to log in
Node.js setTimeout, setImmediate how do they work?
When this code is called, the functions are called in a different order, please explain why?!
function a() {console.log(1);}
function b() {console.log(2);}
setTimeout(a, 0);
setImmediate(b, 0);
-------------------------------------
In this code, always strictly a, then b. Why not in the first case?
function a() {console.log(1);}
function b() {console.log(2);}
setTimeout(a, 0);
setTimeout(b, 0);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question