ForgeFrontend — Prepare, Practice, Crack
Secure checkout
Lifetime access
Instant Drive delivery
Free updates forever

Prepare · Practice · Crack

What is a Promise and what are its states?

Quick answer

An object representing a future value, in one of three states: pending, fulfilled, or rejected — and once settled it never changes.

In detail

A promise lets you attach callbacks for success (`.then`), failure (`.catch`), and cleanup (`.finally`). `.then` returns a new promise so calls chain and flatten the old callback pyramid. Once a promise settles, its state and value are fixed.

fetch("/user")
  .then(r => r.json())
  .then(user => render(user))
  .catch(err => showError(err))
  .finally(() => stopSpinner());

Why interviewers ask this: Foundational async knowledge.

This is 1 of 118+ questions in the JavaScript Interview Kit

Get every question with detailed answers, follow-ups and real code — plus coding challenges and a last-minute revision sheet. One-time payment, instant access.

⚡ Get the JavaScript Interview Kit → ₹299

Full kit

JavaScript Interview Kit · ₹299

Get it →