Do you know what will be the output of this code?
JavaScript
new Promise((resolve) => {
console.log("A");
resolve();
}).then(() => console.log("B"));
console.log("C");
Show answer and explanation
The answer is A C B.
The executor function runs right away, inside the constructor: A. .then callbacks always run later as microtasks, so C is logged before B.