<!DOCTYPE html>
<html>
<head>
<script>
var txt="";
function message()
{
try
{
adddlert("Welcome guest!");
}
catch(err)
{
console.log(err);
txt="There was an error on this page.\n\n";
txt+="Error description: " + err.message + "\n\n";
txt+="Click OK to continue.\n\n";
console.log(txt);
}
}
</script>
</head>
<body>
<input type="button" value="View message" onclick="message()" />
</body>
</html>
Question:
I want to check the contents(e.g.err.message
) inside error
, so I put this line: console.log(err);
in chromo->console, it shows:ReferenceError {}
so my question is:
How could I check the contents/properties inside error
?