Skip to content

QuizNot attempted

Promise.any

What does Promise.any reject with when every input rejects?
1–4 to choose, Enter to submit
Show answer & explanation

Correct answer:

  • An AggregateError whose .errors holds all reasons
  • Promise.any rejects only when every input rejects, and then with an AggregateError whose .errors lists all reasons in input order (an empty iterable rejects immediately).
  • Not the first or the last reason: a single reason would hide the others, so it aggregates them.
  • Not 'never rejects': that is allSettled.