Process Lifecycle · Level 1 of 8

Nothing booked, Node leaves

One timer, a 'beforeExit' listener and an 'exit' listener.

process.on('beforeExit', () => console.log('beforeExit'));process.on('exit', (code) => console.log('exit ' + code));setTimeout(() => console.log('timer'), 10);console.log('main done');

1. Predict the output

Tap the lines in the order you think they print.

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