原文链接: js nextTick 执行优先级比定时器高
上一篇: js 使用流进行文本匹配计数
setTimeout(
() => console.log('1'), 0
)
setTimeout(
() => console.log('2'), 0
)
setTimeout(
() => console.log('3'), 0
)
process.nextTick(
() => console.log('4')
)
process.nextTick(
() => console.log('5')
)
process.nextTick(
() => console.log('6')
)
setInterval(
() => console.log('7'), 0
)
setInterval(
() => console.log('8'), 0
)
setInterval(
() => console.log('9'), 0
)
执行顺序
4
5
6
1
2
3
7
8
9
7
8
9
7
8
9