Course contentsShow
← JavaScript
Lesson 1264 of 2,72329. PromisesFree lesson

Promise States

Promises have three states: pending (initial), fulfilled (operation succeeded), or rejected (operation failed).

Promise States

You'll learn: the three possible states a Promise can be in and what each state means for asynchronous operations.

The Three States

Every Promise in JavaScript exists in exactly one of three states at any given moment:

  1. Pending — The initial state when the Promise is created. The asynchronous operation hasn't finished yet; we're still waiting for a result.

  2. Fulfilled — The operation completed successfully and produced a value. The Promise now holds that successful result.

  3. Rejected — The operation failed or encountered an error. The Promise now holds a reason for the failure (typically an Error object).

State Transitions

A Promise starts in the pending state and can transition to either fulfilled or rejected — but only once. Once a Promise settles (becomes fulfilled or rejected), its state is permanent and unchangeable. You can't reset a Promise or change it from fulfilled to rejected later.

The Analogy

Think of ordering food delivery:

  • Pending: Your order is placed and the restaurant is preparing it. You're waiting.
  • Fulfilled: The food arrives successfully at your door. Order complete!
  • Rejected: The restaurant cancels your order due to an ingredient shortage. Order failed.

Once the delivery succeeds or fails, that outcome is final. The delivery driver can't un-deliver your food or suddenly cancel after you've already eaten.

Why States Matter

Understanding states helps you reason about async operations. When you attach .then() or .catch() handlers, JavaScript checks the Promise's current state to decide whether to run your callbacks immediately (if already settled) or queue them for later (if still pending).

Key Takeaway: Every Promise has exactly one state—pending, fulfilled, or rejected—and transitions from pending to one of the settled states exactly once, permanently.