Hint
Returning a Promise from .then() adds 2 extra microtask ticks β it's slower than returning a plain value.
Promise.resolve()
.then(() => {
console.log(1);
return Promise.resolve(2);
})
.then(v => console.log(v));
Promise.resolve()
.then(() => console.log(3))
.then(() => console.log(4));1 3 4 2
Explanation: Round 1 microtasks: logs 1 (but returning a Promise adds extra ticks), logs 3.
Round 2: logs 4 (chained from 3). The inner Promise.resolve(2) takes 2 extra microtask ticks to unwrap.
Round 3+: logs 2 last.
Key Insight: Returning a Promise from .then() adds 2 extra microtask ticks β it's slower than returning a plain value.