Javascript examples for DOM:Error
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:
<!DOCTYPE html> <html> <body> <p id="demo" style="color:red"></p> <script> try {/*from w ww.j a v a 2 s .c om*/ methodDoesNotExist("Welcome guest!"); } catch(err) { document.getElementById("demo").innerHTML = err.name + "<br>" + err.message; } </script> </body> </html>