JS Built-ins
Promiseracebeginner

Promise.race([]) β€” typeof

πŸ“– Usage Example
const slow = new Promise(res => setTimeout(() => res('slow'), 200))
const fast = new Promise(res => setTimeout(() => res('fast'), 50))
Promise.race([slow, fast]).then(v => {
  console.log(v) // β†’ 'fast'
})

Promise.race() returns a promise that settles as soon as the first promise in the iterable settles.

typeof Promise.race()

typeof Promise.race([]) is 'object'.

Challenge: Verify the return type.

πŸ’‘ Hints (1)
  • β€’ Promise.race() returns a Promise object.