JS Exception Description (Get exception)
<div id= ' bbb ' style= ' display:none ' >asdf</div>
<script>
function A ()
{
try
{
var aaa = document.getElementById (' BBB ');
alert (aaa.innertext);
}
catch (E)
{
alert (' ERROR ' + E.message + ' occurs on ' + E.linenumber + ' line ');
}
A ();
</script>
*
JS exception e In addition to E.message and E.linenumber also has an important attribute e.name
e.name error type,
e.message The details of the error.
Error.name's six values correspond to information:
1. The use of Evalerror:eval () is inconsistent with the definition
2. Rangeerror: The value crosses
3. Referenceerror: Illegal or unrecognized reference value
4. SyntaxError: Syntax resolution error
5 occurred. TypeError: Operand type error
6. Improper use of Urierror:uri processing functions
so your JS code to run to catch the exception of the code, even if the code is wrong, will continue to run the code, will not stop, and the use of the exception to JS debugging also has some help.
*/