1return false; // or return;
2// or
3throw new Error("Here we stop");
4// Node.js:
5process.exit();
1// EXAMPLE
2throw new Error("This is your custom error message");
3
4/*
5SYNTAX
6throw new Error("<your-custom-message>");
7*/
1if(someEventHappened) return; // Will prevent subsequent code from being executed
2alert("This alert will never be shown.");
1// You can make a JavaScript typo :D (thinking outside the box here)
2thisFunctionDoesNotExistAndWasCreatedWithTheOnlyPurposeOfStopJavascriptExecutionOfAllTypesIncludingCatchAndAnyArbitraryWeirdScenario();
3
4// Or something like
5
6new new
7