Can you tell what would be the following output of these snippets?
const promise = new Promise((resolve, reject) => { 20/10/2021
console.log("YAZIF");
setTimeout(() => resolve(), 0);
});
new Promise((resolve, reject) => {
console.log("Yazof");
setTimeout(() => resolve(), 0);
}).then(() => console.log(2));
console.log("CHEDDAR");
promise.then(() => console.log(1));
Verify your answer. Now, can you also answer this?
const promise = new Promise((resolve, reject) => { 20/10/2021
console.log("YAZIF");
resolve();
});
new Promise((resolve, reject) => {
console.log("Yazof");
resolve();
}).then(() => console.log(2));
console.log("CHEDDAR");
promise.then(() => console.log(1));
Top comments (0)