First page Back Continue Last page Image
- This tool is being introduced just to get you thinking about it. We will cover it in more detail later
- try {
- if(!ans || isNum(ans) || ans<0) {
- throw new Error(" Invalid Number");
- }
- alert("The square of " + ans + "is " + Math.sqrt(ans));
- }
- catch (errMsg) {
- alert(errMsg.message);
- }
- This allows you to try something and if it does not work, report why instead of having your program crash