Home
<!DOCTYPE html> <html> <body> <h1>Demo: Error Handling</h1> <p id="errorMessage">Error: </p> <p id="message"></p> <script> try { var result = Sum(10, 20); // Sum is not defined yet } catch(ex) { document.getElementById("errorMessage").innerHTML += ex; } finally{ document.getElementById("message").innerHTML = "finally block executed"; } </script> </body> </html>
Result: