A Promise represents async work eventually settling as fulfilled or rejected. Chains use .then / .catch.
States
pending → fulfilled (value) or rejected (reason). Promise.resolve / reject create immediate outcomes.
Chaining
Return values from then pass to next then. Errors jump to nearest catch.
Important interview questions and answers
- Q: Promise vs callback?
A: Promises flatten nested callbacks; easier error propagation. - Q: Unhandled rejection?
A: Always catch or try/catch with await—crashes Node, console errors in browser.
Self-check
- Name three promise states.
- Where do errors go in a chain?
Tip: Always handle rejections—.catch or try/catch with await.
Interview prep
- Promise states?
pending, fulfilled, rejected.