Home
← All questions

Polyfill for Promise.race in JavaScript

MediumPremiumJavaScript

JavaScript interview practice: Settle with the first promise that settles — whether it fulfils or rejects.

Problem

Implement promiseRace(promises) that settles (resolves or rejects) as soon as the first promise settles, adopting its outcome.

function promiseRace(promises) {
  // your code
}
Premium question

Unlock the in-browser editor, test cases, and model solution with Mentoxis Premium.

Unlock with Premium