A placeholder for a future value
A promise represents a value that is not ready yet. It starts pending, then settles either as fulfilled with a value or rejected with an error. Once settled it never changes again. This single object replaces the pattern of passing callbacks around.
Chaining instead of nesting
Rather than nesting, you attach a handler with then. Each then returns a new promise, so you can line steps up in a flat sequence.
- The first then receives the resolved value and returns the next step.
- The next then receives that result, and so on.
- A single catch at the end handles any rejection along the chain.
Because each then returns a promise, dependent async steps form a readable vertical chain rather than a rightward pyramid.
Why errors propagate cleanly
If any step rejects, the chain skips the remaining then handlers and jumps to the nearest catch. You write error handling once instead of at every level. This is a major improvement over raw callbacks.
Composing many promises
Helpers let you run several promises together. One waits for all to fulfill, another resolves as soon as the first settles. These tools turn promises into building blocks for complex async flows.
Key idea
A promise is a settle once placeholder for a future value, and chaining then handlers flattens dependent async steps while a single catch handles errors across the chain.