Error Object - Javascript DOM

Javascript examples for DOM:Error

Error Object Properties

Property Description
name Sets or returns an error name
message Sets or returns an error message (a string)

Return the error name and a description of the error:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>

<p id="demo" style="color:red"></p>

try {/*from   w ww.j a  v a  2  s .c  om*/
    methodDoesNotExist("Welcome guest!");
catch(err) {
    document.getElementById("demo").innerHTML = + "<br>" + err.message;


Related Tutorials