In PERL there is a ‘die’ function that stops execution of a program if certain conditions are not met.
For example, a needed file is not found because it is miss typed.
Is there a similar function for javascript?
The code I would think would follow something like this:
[code]
var FileName = ”; // might have expected to enter something like ‘ExternalFile.js’ from a Querystring
if (FileName == ”) {
alert(‘Invalid Filename’);
AbortAndDie(); // ??? unknown command or function to stop script execution
}
… continue with rest of script execution.
Maybe something like an HTML <noscript> tag that would inform user of the problem.
Is there anything like this available or can be created for JS?
?