process.exit(1)
You can just use return Example: function myFunction() { console.log("I QUIT!") return; }