下面两段代码,你能说出正确的打印顺序分别是什么吗?
1 | setTimeout(() => { |
1 | const fs = require('fs'); |
不是我懒惰,是我怕翻译错
so
Node 官方解读在这里
下面是写的比较好的博客,它们是一个系列哦:
- Event Loop and the Big Picture — NodeJS Event Loop Part 1
- Timers, Immediates and Process.nextTick — NodeJS Event Loop Part 2
- Promises, Next-Ticks, and Immediates — NodeJS Event Loop Part 3
- Handling IO — NodeJS Event Loop Part 4
- New Changes to the Timers and Microtasks in Node v11.0.0 (and above)
- Event Loop Best Practices — NodeJS Event Loop Part 5