process.nextTick(() => {
console.log("nextTick");
});
setImmediate(() => {
console.log("setImmediate1");
process.nextTick(() => {
console.log("");
});
});
setImmediate(() => {
console.log("setImmediate2");
});
the result of the execution of this code in the higher version of node is:
nextTick
setImmediate1
setImmediate2
node says in this book that the callback functions of process.nextTick ()
are saved in an array, and each round of Tick will execute all the callback functions in the array; setImmediate ()
results are saved in the linked list, and each round of Tick only executes one callback function, which is not consistent with the above implementation results?