NodeJS 事件循环

2021-04-21  本文已影响0人  行走的蛋白质
setImmediate(_ => {
  console.log(0)
})
setTimeout(_ => {
  console.log(1)
})
console.log(2)
new Promise(resolve => {
  console.log(3)
  resolve()
}).then(_ => {
  console.log(4)
})
setImmediate(_ => {
  console.log(5)
})
process.nextTick(_ => {
  console.log(6)
})
console.log('end')
上一篇下一篇

猜你喜欢

热点阅读