Level 25

The full lineup

Sync code, a timer, two promises, a nextTick and an await. Line them all up.

console.log('start');setTimeout(() => {  console.log('timer 1');  Promise.resolve().then(() => console.log('promise in timer'));}, 0);setTimeout(() => console.log('timer 2'), 0);Promise.resolve().then(() => console.log('promise'));process.nextTick(() => console.log('tick'));(async () => {  await null;  console.log('after await');})();console.log('end');

1. Predict the output

Tap the lines in the order you think they print.

  1. 1…
  2. 2…
  3. 3…
  4. 4…
  5. 5…
  6. 6…
  7. 7…
  8. 8…