Promise Combinators
When you have multiple asynchronous operations to coordinate, running them sequentially with multiple await statements wastes time. JavaScript provides static promise combinator methods that manage multiple promises concurrently with different settlement strategies.
Promise.all(iterable)
Waits for all promises to fulfil and returns an array of results in the same order. If any promise rejects, the whole Promise.all immediately rejects with that error — a "fail fast" strategy.
Promise.allSettled(iterable)
Waits for all promises to settle (fulfil or reject) and returns an array of result objects with a status field. Use this when you need all results regardless of individual failures.
Promise.race(iterable)
Settles as soon as the first promise settles (either way). Useful for implementing timeouts.
Promise.any(iterable)
Fulfils as soon as the first promise fulfils. Rejects only if all promises reject (with an AggregateError). Use for "first success wins" strategies like trying multiple CDN mirrors.