Loading...
By continuing to use the platform, you accept the terms of the Privacy Policy and the use of cookies.
Implement promiseRace(promises) function that works like native Promise.race().
promiseRace(promises)
Promise.race()
Requirements:
const result = await promiseRace([ new Promise(res => setTimeout(() => res('slow'), 100)), new Promise(res => setTimeout(() => res('fast'), 50)) ]); // result = 'fast' (first to complete)
Run your code to see results.
Click the Run button above