Namaste JavaScript — Interview Quick Notes
Ep 24: Promise APIs
- Promise.all([p1,p2,p3]) — waits for all to fulfill; rejects immediately on first rejection (fail-fast). Use when all results needed and any failure is fatal.
- Promise.allSettled([p1,p2,p3]) — waits for all to settle; always returns array of {status, value/reason}. Use when you want every result regardless of failure.
- Promise.race([p1,p2,p3]) — settles with the first settled promise (fulfill or reject). Use for timeout patterns.
- Promise.any([p1,p2,p3]) — fulfills with the first success; rejects only if all reject (AggregateError). Use when you need at least one success.