Promises

A promise (Promise) represents the future result of an asynchronous operation. It is pending, then fulfilled (resolved with a value) or rejected (with an error), and does not change state afterwards. You react to it with then, catch and finally.

Example

new Promise((resolve) => setTimeout(() => resolve('ok'), 500))
  .then(console.log)

Related concepts

The whole glossary