1, 3, 2. The .then callback is a microtask; it runs after the synchronous code (1 and 3) completes and the call stack is empty.
Promise Interview Questions in JavaScript
What is the output of console.log('1'); Promise.resolve().then(() => console.log('2')); console.log('3')?
The answer
More FAQs in Promise Interview Questions in JavaScript
The error propagates to the next .catch in the chain. Subsequent .then callbacks are skipped. If there is no .catch, it becomes an unhandled rejection.
No. .catch only runs when the promise rejects or a .then above it throws. If the promise is fulfilled, .catch is skipped and the next .then receives the value.
Promise.all rejects if any promise rejects (fast fail). Promise.allSettled waits for all promises, even if some reject, and returns an array of { status, value/reason } objects.
Still have questions?
Browse all our FAQs or reach out to our support team
Want to upskill yourself?
Your learning library
Small steps. Big possibilities.
Find your next course. Build something great.