Favorites

JavaScript Promise.prototype.finally() 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.finally()
JavaScript Promise Instance methodThis method is supported by all modern browsers.
Updated 28th November 2026

The finally() method runs a function when a promise settles, whether it fulfilled or rejected, which is useful for clean-up such as hiding a loading indicator.

Description

The finally() method schedules a function to run when the promise settles, regardless of the outcome. The callback receives no arguments, and the value or error passes through it unchanged to the next step in the chain. It's the promise version of a finally block.

Unlike then(), its callback can't change the value passing through, unless it throws an error or returns a rejected promise, which replaces the result with that rejection. That makes it safe for clean-up that shouldn't interfere with the outcome, such as re-enabling a button, closing a connection or stopping a spinner.

In async functions, a finally block in a try statement does the same job, and runs whether the awaited operation succeeds or fails.

Syntax

promise.finally(onFinally)

Parameters

  • onFinallyA function, called with no arguments, when the promise settles either way.

Return Value

A new promise that settles the same way as the original.

Example

let loading = true;
Promise.reject(new Error('Network error'))
  .catch(err => console.log(err.message))
  .finally(() => { loading = false; console.log('loading:', loading); });

Browser Support

The following information will show you the current browser support for the Promise.prototype.finally() 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