Level 24

A tick inside a promise

A promise callback queues a nextTick, and another promise is already waiting.

Promise.resolve().then(() => {  console.log('p1');  process.nextTick(() => console.log('tick'));});Promise.resolve().then(() => console.log('p2'));

1. Predict the output

Tap the lines in the order you think they print.

  1. 1…
  2. 2…
  3. 3…