in javascipt how to stop further page processing

Java
if(someEventHappened) return; // Will prevent subsequent code from being executed
alert("This alert will never be shown.");
Source

Also in Java: