Games Node.js Loop Quest The express lane
Promise.race takes the first
The same slow and fast timers, but in Promise.race.
const wait = (ms, v) => new Promise((r) => setTimeout(() => r(v), ms));Promise.race([wait(30, 'slow'), wait(10, 'fast')]) .then((v) => console.log('winner ' + v));console.log('racing');1. Predict the output
Tap the lines in the order you think they print.
- 1…
- 2…