Interview Question

What are promises?

Promises represent future results and support chained reactions.

💡 Concept ✅ Quick Revision ⚡ JavaScript

Answer

A Promise is an object representing the eventual completion or failure of an asynchronous operation. • A promise is pending, fulfilled, or rejected. • then registers fulfillment and rejection reactions and returns a new promise. • Promise reactions run as jobs after the current synchronous execution completes.

Example

Code
Promise.resolve(5)
  .then(value => value * 2)
  .then(console.log);
Output
10

Quick Revision

Promises represent future results and support chained reactions.