Games Node.js Loop Quest Don't block the chef
An endless express lane
The same trick with promises: a callback that keeps queueing itself with .then.
let n = 0;function spin() { if (++n < 3) Promise.resolve().then(spin); else console.log('promises done');}setImmediate(() => console.log('immediate'));Promise.resolve().then(spin);1. Predict the output
Tap the lines in the order you think they print.
- 1…
- 2…