For example, if we call an undefined function, an error will occur:
try
{
nafunc();
}
catch (e)
{
alert(e.description); //will popup "undefined"
}
The
try
{
nafunc();
}
catch (e)
{
alert(e.description);
}
finally
{
alert("over");
}
The
var ay = new Array(1,0,4);
for (var i=1;i<3;i++)
{
try
{
if (ay[i] == 0) {throw("divided by zero");}
}
catch (e)
{
alert(e); //will popup "divided by zero"
}
}