Is there something like "die" in JavaScript? I've tried with "break", but doesn't work :)
The die() method removes one or more event handlers, added with the live() method, for the selected elements.
The die() function prints a message and exits the current script.
It does not return. The script is terminated and nothing else is executed.
The die() function is an alias of the exit() function.
throw new Error("my error message");
You can only break
a block scope if you label it. For example:
myBlock: { var a = 0; break myBlock; a = 1; // this is never run }; a === 0;
You cannot break a block scope from within a function in the scope. This means you can't do stuff like:
foo: { // this doesn't work (function() { break foo; }()); }
You can do something similar though with functions:
function myFunction() {myFunction:{ // you can now use break myFunction; instead of return; }}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With