cf.completefrontend

Predict the outputEasy

What does this log when the executor calls resolve twice and then reject?

What does this log?
const p = new Promise((resolve, reject) => {
  console.log("executor");
  resolve("first");
  resolve("second");
  reject(new Error("third"));
  console.log("after resolve");
});
 
p.then((value) => console.log("then:", value)).catch((error) => console.log("catch:", error.message));
 
console.log("end");

The answer

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

Checking your sign-in…