Process Lifecycle · Level 4 of 8

process.exit() is the fire alarm

A timer is booked, then the script calls process.exit(0).

process.on('exit', (code) => console.log('exit ' + code));setTimeout(() => console.log('timer'), 100);console.log('pulling the alarm');process.exit(0);console.log('never');

1. Predict the output

Tap the lines in the order you think they print.

  1. 1…
  2. 2…