js stop script code example
Example 1: how to terminate a program in js
process.exit(1)
Example 2: java stop script
public void onClick() {
if(condition == true) {
return;
}
string.setText("This string should not change if condition = true");
}
Example 3: in javascipt how to stop further page processing
if(someEventHappened) return; // Will prevent subsequent code from being executed
alert("This alert will never be shown.");