Node.js Event Loop & V8 engine & libuv All In One
事件循环
const cb1 = () => console.log(`1`);
const cb2 = () => console.log(`2`);
const cb3 = () => console.log(`3`);
const cb4 = () => console.log(`4`);
const cb5 = () => console.log(`5`);
const cb6 = () => console.log(`6`);
setTimeout(cb1, 0);
Promise.resolve().then(cb2);
process.nextTick(cb3);
fs.readFile(cb4);
setImmediate(cb5);
setInterval(cb6);