Skip to content
JavaScript·Intermediate·Coding·1 min read

What does then return?

Short interview answer

then immediately returns a new promise. That promise resolves to the handler's return value, adopts a returned thenable, or rejects if the handler throws. This flattening is what makes promise chains compose without nested callbacks.

Example

JavaScript
fetch('/api/user')  .then((res) => res.json())      // returns a promise -> chain waits for it  .then((user) => user.name)      // plain value -> next promise fulfills with it  .catch((err) => 'anonymous');   // a throw/rejection anywhere lands here

Key takeaway

Explain the underlying mental model clearly, then support it with a concrete example and its trade-offs.

← Back to Promises

Related questions