What is the purpose of the Promise.allSettled() method and how does it differ from Promise.all()?

Node.js Developer Hard

Node.js Developer — Hard

What is the purpose of the Promise.allSettled() method and how does it differ from Promise.all()?

Key points

  • Promise.allSettled() waits for all promises to settle, regardless of outcome
  • Promise.all() rejects immediately if any promise rejects
  • Promise.allSettled() returns an array of result objects with status and value/reason
  • Promise.all() stops at the first rejection, making it fail-fast

Ready to go further?

Related questions