Let’s see how the execution goes for this promise constructor.
new Promise((resolve) => {
setTimeout(() => resolve("Done!"), 100);
})
.then(result => console.log(result));
We have the promise constructor that has a setTimeout
and we also have a then
handler.
let’s just go through it step by step and see what’s happens.
First, the new Promise
constructor is added to the Call Stack