I am new to Java Script. In the below code I am trying to create an error intentionally to learn how try...catch works. But nothing is running.
<html>
<body>
<p id="demo"></p>
<script>
try {
adddlert("Hi User!");
}
catch(Error e) {
document.getElementById("demo").innerHTML = e.message;
}
</script>
</body>
</html>
What I am missing?
try {
adddlert("Hi User!");
}
catch(e) {
document.getElementById("demo").innerHTML = e.message;
}
<html>
<body>
<p id="demo"></p>
</body>
</html>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With