What is a Promise?
A Promise is a JavaScript object representing the eventual completion or failure of an asynchronous operation. It can be pending, fulfilled, or rejected. Promises can be composed with methods such as then(), catch(), and finally(), and can be consumed conveniently using async/await.
Key Takeaways
- Promises represent asynchronous results.
- They can be fulfilled or rejected.
- async/await is built on Promise-based asynchronous programming.
Knowledge Check
Which states can a Promise have?