JS TRY-CATCH EXAMPLE
Run
<html>
    <head>
        <title>
            Using try-catch statement
        </title>
        <script type="text/javascript">
            try
            {
                /*  n is undefined, so below
                    code will throw an exception
                */
                document.write(n);
                // the line below will not be executed
                document.write("Hello World!");
            }
            catch(err)
            {
                document.write(err.message);
            }
        </script>
    </head>
    <body>
        <!-- HTML body -->
    </body>
</html>