Favorites

JavaScript Promise.prototype.then() Method

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee
Promise.prototype.then()
JavaScript Promise Instance methodThis method is supported by all modern browsers.
Updated 28th November 2026

The then() method registers functions to run when a promise fulfills (or rejects), and returns a new promise so calls can be chained.

Description

The then() method schedules a callback to run with the promise's value once it fulfills. It always returns a new promise, resolved with whatever the callback returns, which is what makes chains like fetch(url).then(r => r.json()).then(data => ...) work. If the callback returns a promise, the chain waits for it.

Callbacks always run asynchronously, after the current code finishes, even if the promise is already settled. Many developers prefer async/await, which does the same thing with less nesting.

If the callback throws, the promise returned by then() rejects with that error, which a later catch() can handle. If you pass a second callback for rejections, it only handles failures of the previous promise, not errors thrown by the first callback in the same then(), which is why a separate catch() at the end is usually clearer.

Syntax

promise.then(onFulfilled)
promise.then(onFulfilled, onRejected)

Parameters

  • onFulfilledA function called with the value when the promise fulfills. What it returns becomes the value of the next promise.
  • onRejectedOptional. A function called with the reason if the promise rejects.

Return Value

A new promise, which lets calls be chained.

Example

Promise.resolve(2)
  .then(n => n * 10)
  .then(n => new Promise(r => setTimeout(() => r(n + 1), 100)))
  .then(n => console.log('Result:', n));

console.log('This logs first');

Browser Support

The following information will show you the current browser support for the Promise.prototype.then() method. Hover over a browser icon to see the version that first introduced support for this method.

This method is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee