All interview questions
What is the difference between Promise.all and Promise.allSettled?
IntermediateAnswer
Promise.all fulfills when every input fulfills and rejects when the first input rejects. Promise.allSettled waits for every input and returns a result object for each one.
Explanation
Use all when every result is required. Use allSettled when independent failures need to be reported separately. Neither automatically cancels work already started.
Example
const results = await Promise.allSettled(tasks)