Q15: What is a Promise and what are its three states?
A Promise represents the eventual completion or failure of an asynchronous operation. Its states are: 1) pending (initial state), 2) fulfilled (operation succeeded), 3) rejected (operation failed). State transitions are immutable once settled.
Key Takeaways
Promises encapsulate async outcomes in pending, fulfilled, or rejected states.
Transitions are permanent; settled states cannot change.
Knowledge Check
What occurs if resolve() and reject() are both called inside the same Promise executor?