In the next video, you’ll get a brief introduction from Sakshi using an analogy for promises in JavaScript, which is the concept that you’ll be learning about in all the segments related to promises.
In the next video, you’ll learn from Srishti what a promise is and what role it plays in the asynchronous programming.
In the last video, you learned the following facts:
1. There are two types of code in asynchronous programming:
2. A promise is an object which makes the result produced by the producer code available to the consumer code, thus linking them together.
3. The producer code is contained inside the promise object.
4. The producer code, which is inside the promise object, contains resolve & reject callbacks.
5. The producer code is executed as soon as the promise object is created. You do not need to explicitly call the producer code.
You also learned the following syntax of defining a promise object:
Syntax of a Promise:
let promiseObj = new Promise((resolve, reject) => { // producer code });
Now that you’ve got an idea about what a promise is, you’ll learn from Srishti about the properties of a promise object in the next video.
In the last video, you learned the following facts:
1. The internal properties of an object are the ones which cannot be accessed directly or manipulated. Also, the internal properties are enclosed within double square brackets [[]].
2. A promise object consists of two internal properties:
3. When a promise object is created, the [[PromiseStatus]] property is initialized with ‘pending’ and the [[PromiseValue]] property is initialized with undefined.