Skip to content

OutputNot attempted

Two chains interleave

Promise.resolve()
.then(() => console.log('a1'))
.then(() => console.log('a2'));
Promise.resolve()
.then(() => console.log('b1'))
.then(() => console.log('b2'));

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.

Each .then is queued only when the previous step settles, so the two chains take turns: a1 b1 a2 b2.