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 ...
Get Get Programming with JavaScript Next now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.