Right click this window and select "view source" in order to copy the source for this script.

JavaScript Try Catch

View the source. Try and Catch is often used with Throw. This demonstration is an example of how to trap errors inside of a program or script and handle them. In this case, we are displaying the JavaScript error in an alert box, requesting a confirmation.