Contents

Breaks Functions

Script Errors

Try and catch, are used to try some code, and catch any errors. It is also possible to create errors using the throw command.


try{
}catch(Error){
}

throw(Error);

Example:


var Age=17;
try{
if(Age<18){
throw("You are not old enough.");
}
alert("Welcome");
}catch(Error){
alert("Sorry, you can not enter.\r\n"+Error);
}

Breaks Functions