process.exit() ends the process immediately, so pending async work such as writes to stdout can be lostprocess.exit() ends the process as soon as possible. It does this even when asynchronous work is still pending, such as output that is still being written to stdout. That output can be lost.
Setting process.exitCode = 1 does not stop anything. The event loop finishes its remaining work, and then the process exits with that code.
The other options are wrong:
• "process.exit() is deprecated": it is not deprecated.
• "process.exit() ignores the exit code you pass": it does use the code you pass.
• "process.exit() waits for all timers": it does the opposite. It does not wait for anything.
Read more