1. Promise.all
Promise.all resolves to an array of values when every input fulfills, but rejects as soon as any one rejects.
Promise.all([a, b]) // all fulfill → array; first reject → rejectsTyporithm · medium
Step 1 of 8 · intro card
Async & Event Loop
Promise.all rejects on the first rejection but otherwise resolves to an array; Promise.race settles with whichever promise settles first (fulfill or reject); Promise.allSettled waits for all and never rejects; Promise.any takes the first fulfillment and rejects only if all reject, with an AggregateError.
Promise.all([...]) resolves to an array of results once every promise fulfills, but it short-circuits and rejects with the reason of the first promise to reject — so one failure fails the whole batch.
Promise.race([...]) settles with the first promise to settle, fulfilling or rejecting to match it; Promise.any([...]) instead waits for the first fulfillment and only rejects, with an AggregateError, if every promise rejects.
Promise.allSettled([...]) is the forgiving one: it waits for all promises and never rejects, resolving to an array of {status: "fulfilled", value} or {status: "rejected", reason} objects so you can inspect each outcome.
all → array on all-fulfill, rejects on first rejection.
race → first to settle (fulfill OR reject); any → first fulfill.
allSettled → waits for all, never rejects; any rejects only if all reject (AggregateError).
Promise.all([a, b]) // all fulfill → array; first reject → rejects
Promise.race([a, b]) // first to settle (fulfill OR reject) wins
Promise.allSettled([a, b]) // waits for all; never rejects
Promise.any([a, b]) // first fulfill; all reject → AggregateErrorConnect each part of the code to the concept before you type.
Promise.all resolves to an array of values when every input fulfills, but rejects as soon as any one rejects.
Promise.all([a, b]) // all fulfill → array; first reject → rejectsPromise.race settles with the first promise to settle, whether it fulfills or rejects.
Promise.race([a, b]) // first to settle (fulfill OR reject) winsPromise.allSettled waits for every promise and never rejects, returning a {status, value|reason} per input.
Promise.allSettled([a, b]) // waits for all; never rejectsPromise.any fulfills with the first fulfillment and only rejects (with an AggregateError) if every input rejects.
Promise.any([a, b]) // first fulfill; all reject → AggregateErrorRead the concept map and follow the code breakdown.
Type the implementation, repair mistakes and work through every recall exercise.
Use the final check without hints; revisit weak concepts in short practice sessions.