Intermediate JavaScript
Q52 / 100

What is the difference between Promise.race() and Promise.any()?

Correct! Well done.

Incorrect.

The correct answer is B) race() settles (resolves or rejects) with the first settled Promise; any() resolves with the first resolved Promise and only rejects if all reject

B

Correct Answer

race() settles (resolves or rejects) with the first settled Promise; any() resolves with the first resolved Promise and only rejects if all reject

Explanation

race() is first-settled (could be a rejection). any() ignores rejections and resolves with the first success, rejecting with AggregateError if all fail.

Progress
52/100