We'll turn now to the third topic in this chapter: handling errors. This topic isn't so much about syntax errors, which cause your script not to run in the first place, but handling errors that happen at runtime, such as when a numeric value is greater than can fit into a JavaScript variable. You can handle runtime errors two ways in JavaScript:You can use the onerror event handler; and, more recently, you can use try catch statements. I'll take a look at both techniques here. |