Answer the question
In order to leave comments, you need to log in
Node.js setImmediate, setTimeout, how do they work?
function timeout0() {
console.log('timeout 0');
}
function immediate() {
console.log('immediate');
}
setTimeout(timeout0, 0);
setImmediate(immediate);
If you run this code 10 times, you can see that the order of the functions is different, sometimes timeout 0 fires first, and sometimes immediate. Why is that?
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