joeteach4 Posted October 2, 2019 Share Posted October 2, 2019 https://www.w3schools.com/js/tryit.asp?filename=tryjs_try_catch please revise this tutorial current code: document.getElementById("demo").innerHTML = err.message; suggested code: document.getElementById("demo").innerHTML = "error detected"; Link to comment Share on other sites More sharing options...
Funce Posted October 2, 2019 Share Posted October 2, 2019 This tutorial illustrates both try and catch statements. The purpose of that line is to output the specific error that has been thrown in the try statement. "error detected" can mean anything between undefined variable to a syntax error. err.message will take the error message that would otherwise normally be put in the console, and put it into the demo <p> element. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now