Suggest an editImprove this articleRefine the answer for “Promise states”. Your changes go to moderation before they’re published.Approval requiredContentWhat you’re changing🇺🇸EN🇺🇦UAPreviewTitle (EN)Short answer (EN)A **promise** has three states: `pending` (waiting), `fulfilled` (successfully resolved), and `rejected` (rejected with an error). **Key point:** once a promise moves to `fulfilled` or `rejected`, it becomes settled, and its state can no longer change.Shown above the full answer for quick recall.Answer (EN)Image## A promise has three states | State | Name | What it means | | --- | --- | --- | | `pending` | **Waiting** | The asynchronous operation has not finished yet. The promise is "in progress". | | `fulfilled` | **Resolved (successfully)** | The operation finished successfully, `resolve(value)` was called. | | `rejected` | **Rejected (with an error)** | The operation finished with an error, `reject(reason)` was called or an exception was thrown. | ## The `pending` state (waiting) A promise is created in this state by default. ```javascript const promise = new Promise(() => { // nothing called yet → pending }); ``` It **has no result** and **waits** until `resolve()` or `reject()` is called. ## The `fulfilled` state (resolved successfully) A promise becomes **fulfilled** when `resolve(value)` is called. ```javascript const promise = new Promise((resolve) => { resolve('Success!'); }); ``` It now has a **result**, which can be handled in `.then()`: ```javascript promise.then(value => console.log(value)); // Success! ``` ## The `rejected` state (finished with an error) A promise becomes **rejected** when `reject(reason)` is called or an error is thrown (`throw`) inside the promise body. ```javascript const promise = new Promise((resolve, reject) => { reject('Network error'); }); ``` The error can be caught via `.catch()`: ```javascript promise.catch(error => console.log(error)); // Network error ``` ## Important: the transition happens only once After moving to `fulfilled` or `rejected`, a promise becomes **settled** - and **its state can no longer change**. ```javascript const promise = new Promise((resolve, reject) => { resolve('OK'); reject('Error'); // ignored }); ``` The promise "locked in" as `fulfilled` and will not change state anymore. ## An additional term: "settled" "Settled" is a **general state** where a promise is already **not pending**, meaning it is: - either `fulfilled`, - or `rejected`. > All settled promises are called **settled**, > but not all settled promises are "successful". ## A visual diagram of transitions ```javascript (creation) │ ▼ pending / \ / \ (resolve) ▼ ▼ (reject) fulfilled rejected ``` ## Example with a delay ```javascript const promise = new Promise((resolve, reject) => { console.log('pending...'); setTimeout(() => resolve('done'), 2000); }); promise .then(res => console.log(res)) .catch(err => console.error(err)); ``` Sequence: ```javascript pending... done ``` ## Summary | State | What it means | How it transitions | What handles it | | --- | --- | --- | --- | | `pending` | Waiting for a result | - | - | | `fulfilled` | The operation finished successfully | `resolve(value)` | `.then()` | | `rejected` | An error occurred during execution | `reject(error)` / `throw` | `.catch()` | | `settled` | The promise is finished (fulfilled or rejected) | - | `.finally()` |For the reviewerNote to the moderator (optional)Visible only to the moderator. Helps review go faster.