What is the difference between Promise.all and Promise.allSettled?
Promise.all rejects if any promise rejects, so all must succeed. Promise.allSettled waits for all and gives each result with a status, never rejecting. Use all when all must succeed, allSettled when you want all results regardless.
Verify This Answer
Cross-check this information using these trusted sources:
More FAQs in Async JavaScript and DOM Interview Questions With Answers
Syntax for promises that lets you write async code that looks synchronous. await pauses the function until the promise settles, and async marks a function as returning a promise. It is still promises under the hood, just cleaner syntax.
The call stack runs sync code. Async callbacks go to the microtask queue (promises) or the macrotask queue (setTimeout, events). When the stack is clear, the event loop processes all microtasks, then one macrotask, and repeats.
Using one listener on a parent to handle events from many children, through event bubbling and the event target. It is efficient for large or dynamic lists, since you do not attach a listener to every child, and it is a common DOM interview topic.
Still have questions?
Browse all our FAQs or reach out to our support team
