how to stop running a function in javascript code example
Example 1: javascript stop execution
// EXAMPLE
throw new Error("This is your custom error message");
/*
SYNTAX
throw new Error("<your-custom-message>");
*/
Example 2: stop a function javascript
function func() {
if (conditionToStopFunction)
return; //Nothing after return will be executed
console.log("Hello World"); //This will not be executed if 'conditionToStopFunction' is true
}