Try catch user exception : Error : Development JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » Development » Error »

 

Try catch user exception

















<html>
<head>
<title>Try Catch Example</title>
<script type="text/javascript">

function addTwoNumbers(a, b) {
    throw new Error("Two numbers are required.");
}

try {
    result = addTwoNumbers(90);
catch (oException) {
    alert(oException.message);
}

</script>
</head>
<body>
</body>
</html>







HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo Development
» Error