Home of web learners
www.webn3rd.com
javascript can work with exception handling
Lets look below example
<html>
<head>
<title>Exception handling</title>
</head>
<body>
<script>
var b = 5;
try {
document.write(a);
}
catch ( e ) {
document.write(e.description);
}
</script>
</body>
</html>
Here,we use try,catch to get error,in try block if there any error occur,then in catch block we can get the error by e.description,if we run this script,then we got error details,as in the code,we write code to show output for a variable,but a variable value is not defined,so we get the error occurred in the code
webn3rd.com
About webn3rd