Home
<!DOCTYPE html> <html> <body> <h1>Demo: throw</h1> <p id="errorMessage"></p> <script> try { throw { number: 101, message: "Error occurred" }; } catch(ex) { document.getElementById("errorMessage").innerHTML = ex.number + "- " + ex.message; } </script> </body> </html>
Result: