Games Node.js Loop Quest Don't block the chef

Level 42

An endless VIP line

A function that keeps queueing itself with nextTick, next to a 0ms timer.

let n = 0;function spin() {  if (++n < 3) process.nextTick(spin);  else console.log('ticks done');}setTimeout(() => console.log('timer'), 0);process.nextTick(spin);

1. Predict the output

Tap the lines in the order you think they print.

  1. 1…
  2. 2…