Promises as State Machines
A Promise represents the eventual result of an asynchronous operation. It starts pending and transitions to either fulfilled or rejected. Once settled, its state does not change again.
Calling then, catch, or finally creates promise reactions that are scheduled asynchronously. A promise does not itself perform background work; it represents and coordinates eventual completion.
Promise States
Key Takeaways
- A Promise can be pending, fulfilled, or rejected.
- Settled promises cannot transition again.
- Promises represent eventual outcomes and chain asynchronous operations.
Knowledge Check
Which transition is valid for a Promise?