JavaScript Promise Object
The Promise Object represents the completion or failure of an asynchronous operation and its results.
A Promise can have 3 states:
| pending | initial state |
| rejected | operation failed |
| fulfilled | operation completed |
Promise Object Methods
Revised December 2025
Instance Methods
| Method | Description |
|---|---|
| .catch(onRejected) | Provides a function to run when a promise is rejected |
| .finally(onFinally) | Provides a function to run when a promise is fulfilled or rejected |
| .then(onFulfilled, onRejected) | Provides two functions to run when a promise is fulfilled |
Static Methods
| Method | Description |
|---|---|
| Promise.all() | Returns a single Promise from a list of promises When all promises fulfill |
| Promise.allSettled() | Returns a single Promise from a list of promises When all promises sette |
| Promise.any() | Returns a single Promise from a list of promises When any promise fulfills |
| Promise.race() | Returns a single Promise from a list of promises When the faster promise settles |
| Promise.reject() | Returns a Promise rejected with a given value |
| Promise.resolve() | Returns a Promise resolved with a given value |
| Promise.then() | Provides two callbacks: One funtion to run when a promise is fulfilled. One funtion to run when a promise is rejected. |
| Promise.try() | Executes a function and wraps its result in a promise. |
| Promise.withResolvers() | Returns an object containing a new Promise object and two functions to resolve or reject it. |