Search for a command to run...
A1 B1 A2 B2 A3 B3 · one link per drain pass, appended at the tail
Chain A registers — but only A1 is queued
Promise.resolve() is fulfilled, so .then(A1) queues a microtask immediately.
Execution
1Promise.resolve()2 .then(() => console.log('A1'))//microtasks: 13 .then(() => console.log('A2'))4 .then(() => console.log('A3'));5 6Promise.resolve()7 .then(() => console.log('B1'))8 .then(() => console.log('B2'))9 .then(() => console.log('B3'));10 11console.log('sync');