xxxxxxxxxx
// This is a Node.js example
console.log("Before exit");
process.exit(0);
console.log("After exit"); // This line will not be executed
xxxxxxxxxx
You can just use return
Example:
function myFunction() {
console.log("I QUIT!")
return;
}
xxxxxxxxxx
function exampleFunction() {
console.log("Before exit");
return; // Exiting the function without returning a value
console.log("After exit"); // This line will not be executed
}
// Calling the function
exampleFunction();