Javascript examples for Statement:try catch finally
catch block catches the error, and executes a code to handle it:
<!DOCTYPE html> <html> <body> <p id="demo"></p> <script> try {/*from ww w.j a v a2 s. c o m*/ methodDoesNotExist("Welcome guest!"); } catch(err) { document.getElementById("demo").innerHTML = err.message; } </script> </body> </html>