promise
A promise is an object that stands in for the result of an asynchronous operation that hasn’t finished yet, so code can attach handlers for the value or the failure before either one exists.
The Promise global object creates and combines promises, and the async and await keywords build on them. Host APIs such as fetch() return promises instead of taking a callback.
Every promise is in one of three states. It starts out pending, then settles once, either fulfilled with a value or rejected with a reason, usually an Error. A settled promise never changes state again:
Handlers attached to a settled promise still run, always as microtasks. ECMA-262 also calls a promise resolved once it’s settled or locked in to follow another promise, so a resolved promise can still be pending. Any object with a .then() method, called a thenable, can stand in for a promise when code resolves or awaits it.
Example
Say a dashboard loads a user profile from a slow service. A loadProfile() function simulates the request with a 100-millisecond timer and returns a promise right away:
> function loadProfile(id) {
… return new Promise((resolve) => {
… setTimeout(() => resolve({ id, name: "Ada" }), 100);
… });
… }
undefined
> const profile = loadProfile(7);
undefined
> profile
Promise { <pending> }
> await profile
{ id: 7, name: 'Ada' }
The call returns before the timer fires, so profile starts out pending. When the timer callback calls resolve(), the promise fulfills with the profile object, and await hands that value back.
A promise settles only once. Say a payment step and a timeout both try to settle the same promise, and the payment gets there first:
> const payment = new Promise((resolve, reject) => {
… resolve("paid");
… reject(new Error("Payment timed out"));
… });
undefined
> await payment
'paid'
The reject() call runs after resolve() and has no effect, so the promise stays fulfilled with 'paid'. Nothing throws, and the rejection reason is silently discarded.
Have a question about this? Mentor AI can show you examples, compare related terms, and point you to tutorials.
By Leodanis Pozo Ramos • Updated Nov. 16, 2026