cf.completefrontend

Predict the outputEasy

When does a promise's executor run, and when does its then callback run?

What does this log?
console.log("A");
const promise = new Promise((resolve) => {
  console.log("B");
  resolve("C");
  console.log("D");
});
promise.then((value) => console.log(value));
console.log("E");

The answer

Work out every line it logs, in order. Then check.

Checking your sign-in…