1 | console.log('script start') |
最终结果
safari,ff,nodejs与此结果一致,chrome某些版本会多出现一次interval(promise4后)
1
2
3
4
5
6
7
8
9
10
11script start
promise1
promise2
setInterval
setTimout1
promise3
promise4
setInterval
timeout2
promise5
promise6
参考链接
https://stackoverflow.com/a/30910084
https://blog.risingstack.com/node-js-at-scale-understanding-node-js-event-loop/
分析步骤
1 | /// whole script tag as task,start exec |