OutputNot attempted
Promise executor runs sync; settles once
const p = new Promise((resolve, reject) => { console.log('a'); resolve(1); console.log('b'); reject(2); resolve(3);});p.then((v) => console.log('then', v)).catch((e) => console.log('catch', e));console.log('c');Spaces and quote style don’t matter · write a thrown error as TypeError
Ctrl Enter
Show answer & explanation
The expected output comes from actually running the snippet; opening this shows it next to the explanation.
The executor runs synchronously. A promise settles exactly once; later resolve/reject calls are ignored. .then callbacks are always async, so "c" comes before "then 1".