javascript stop execution

JavaScript
// EXAMPLE
throw new Error("This is your custom error message");

/*
SYNTAX
throw new Error("<your-custom-message>");
*/if(someEventHappened) return; // Will prevent subsequent code from being executed
alert("This alert will never be shown.");{
  -------
      }
Source

Also in JavaScript: