The exit method terminates the process with the specified code as shown below.
In the above method, code is passed as a parameter which is an integer value whose default value is 0. Now to exit with a failure code you will specify the code like :
ALSO READ : Process Object in NodeJS
One thing to note that process.exit() will exit the program even if there are asynchronous operations pending that have not completed.
If you are in Windows Command Line or Unix Terminal and want to exit the Node REPL you can type
1. CTRL + C Twice (CTRL + C & CTRL + C)
2. Type .exit and press Enter
ALSO READ ; Keyboard Control And Commands in Node.js (REPL)
Please Like and Share the CodingDefined Blog, if you find it interesting and helpful.