<html>
<head>
<title>Try Catch Example</title>
<script type="text/javascript">
function assert(bCondition, sErrorMessage) {
if (!bCondition) {
throw new Error(sErrorMessage);
}
}
try {
assert(1 == 2, "Two numbers are required.");
} catch (oException) {
alert(oException.message); //outputs "Two numbers are required."
}
</script>
</head>
<body>
</body>
</html>
4.1.assert |
| 4.1.1. | Assert method |
| 4.1.2. | Catch exception throwed from assert function |