Promise.prototype.finally()

The finally() method returns a Promise and the passed callback is called once the promise is settled, whether fulfilled or rejected.

Syntax

p.finally(onFinally);

p.finally(function() {
   // settled (resolved or rejected)
});

Parameters

onRejected
A Function called when the Promise is settled.

Return value

Returns a Promise.

Description

The finally method can be useful if you want to do some processing or cleanup once the promise is settled, irrespective of its outcome.

Examples

//tbd

Specifications

Specification Status Comment
TC39 proposal Stage 3  

Browser compatibility

No compatibility data found. Please contribute data for "javascript.builtins.Promise.finally" (depth: 1) to the MDN compatibility data repository.

See also

Document Tags and Contributors

 Contributors to this page: fscholz, jsx
 Last updated by: fscholz,