O'Reilly logo

Get Programming with JavaScript Next: New features of ECMAScript 2015, 2016, and beyond by JD Isaacks

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Lesson 30. Promises

After reading lesson 30, you will be able to

  • Use promise-based libraries to fetch asynchronous data
  • Do basic error handling for promises
  • Memoize asynchronous calls using Promise.resolve
  • Combine several promises into one

A promise is an object that represents an eventual value. You can access this eventual or future value by calling .then() on the promise and supplying a callback function. The promise will eventually invoke this callback with the value. If the promise is still waiting for the value (the promise is in a pending state), then the promise will wait until the value is ready or has loaded (at which point the promise enters the resolved state) before invoking the callback with the value. If the promise has already ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required