JSVerse
Async & Browser JS / Promise Methods

Promise.all, race, allSettled, any

Four ways to combine multiple promises, each with a different rule for when to settle.

`Promise.all` waits for every promise to fulfill and rejects immediately if any one rejects. `Promise.allSettled` waits for all of them regardless of outcome, and reports each result individually — nothing short-circuits. `Promise.race` settles as soon as the very first promise settles, whether that's a fulfillment or a rejection. `Promise.any` settles as soon as the first one fulfills, ignoring rejections unless all of them reject.

Codeeditable — Run executes your edits
Loading...
Console
Output will appear here
Visualization
Promise State
PENDING
FULFILLED
REJECTED
Why?

Promise.all must wait for the slowest one before it can resolve with both results. Promise.race only cares about whichever promise crosses the finish line first — here, fast.