Games Node.js Loop Quest The VIP line
The full lineup
Sync code, a timer, two promises, a nextTick and an await. Line them all up.
console.log('start');setTimeout(() => { console.log('timer 1'); Promise.resolve().then(() => console.log('promise in timer'));}, 0);setTimeout(() => console.log('timer 2'), 0);Promise.resolve().then(() => console.log('promise'));process.nextTick(() => console.log('tick'));(async () => { await null; console.log('after await');})();console.log('end');1. Predict the output
Tap the lines in the order you think they print.
- 1…
- 2…
- 3…
- 4…
- 5…
- 6…
- 7…
- 8…