Level 27

A tick inside a tick

A nextTick queues another nextTick while a promise is waiting.

process.nextTick(() => {  console.log('tick 1');  process.nextTick(() => console.log('tick 2'));});Promise.resolve().then(() => console.log('promise'));

1. Predict the output

Tap the lines in the order you think they print.

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