Games Node.js Loop Quest Don't block the chef
A busy stack delays timers
A 0ms timer, then a loop that keeps the CPU busy for 200ms.
const start = Date.now();setTimeout(() => console.log('timer'), 0);while (Date.now() - start < 200) {}console.log('loop finished');1. Predict the output
Tap the lines in the order you think they print.
- 1…
- 2…