What is the difference between Promise.all, allSettled, race and any?

Node.js modules, files and async · Freshers and experienced

Model answer

all resolves with every result, or rejects as soon as one rejects. allSettled waits for all and reports each success or failure. race settles with the first promise to settle. any resolves with the first success and rejects only if all fail.

Learn this topic

Async JavaScript in Node: Promises, async/await and the Event Loop in the course Node.js and Express: Build a Back End API from Scratch.

Sign in to add your own answer.

More questions