JavaScript Standard Error Instance Properties
constructor
Specifies the function that created an instance's prototype.
message
Error message.
name
Error name.
<html>
<head>
<title>Error Handling</title>
<script language='javascript'>
window.onload = function()
{
try
{
var x = 1;
var value = x / y;
}
catch(err)
{
alert("constructor"+ ": " + err.constructor +'\r\n' + 'message'+ ": " + err.message + '\r\n' + 'name' + ": "+ err.name);
}
finally
{
alert("Finally block");
}
}
</script>
</head>
</html>
constructor
Specifies the function that created an instance's prototype.
message
Error message.
name
Error name.
<html>
<head>
<title>Error Handling</title>
<script language='javascript'>
window.onload = function()
{
try
{
var x = 1;
var value = x / y;
}
catch(err)
{
alert("constructor"+ ": " + err.constructor +'\r\n' + 'message'+ ": " + err.message + '\r\n' + 'name' + ": "+ err.name);
}
finally
{
alert("Finally block");
}
}
</script>
</head>
</html>
No comments:
Post a Comment