I was going through a tutorial about Promises in Javascript. I saw usages of then() method in many places.
When I wrote the below code, I saw the "then()" function under __proto__
section of the console.
const myPromise = new Promise(function(resolve, reject) {});
console.log(myPromise);
But I am not able to observe the same "then()" function when I wrote the below code,
class Car {
constructor(color, type, doors) {
this.color = color;
this.type = type;
this.doors = doors
}
}
const myCar = new Car('blue', 'sedan', '4');
console.log(myCar);
So , I was thinking that , Can we create our own then()
function in Javascript and execute it?.