Promises
In this lesson, you will learn how a JavaScript promise and its states make asynchronous operations easier.
We'll cover the following...
Introduced with ES6, promises are a new way of dealing with asynchronous operations in JavaScript.
Introduction
A promise is an object that might produce values in the future. Just like in real life, we don’t know if the promise will be kept, and we use the promise object as a placeholder while we wait for the outcome.
const promise = new Promise();
Having an object as a proxy for future values lets us write the code in a synchronous manner. We receive the promise object and continue executing the code. However, there is a bit more to it, as you will see.
The promise constructor takes one argument: a callback with two parameters, one ...
Access this course and 1400+ top-rated courses and projects.