JavaScript Error message
Example
Return an error message:
try {
adddlert("Welcome guest!");
}
catch(err) {
document.getElementById("demo").innerHTML = err.message;
}
Try it Yourself »
Description
The message
property sets or returns an error message.
See Also:
The name property of the Error object.
Syntax
errorObj.message
Return Value
A string describing the error (varies between browsers). |
Browser Support
error.name
is an ECMAScript1 (JavaScriopt 1997) feature.
It is supported in all browsers:
Chrome | Edge | Firefox | Safari | Opera | IE |
Yes | Yes | Yes | Yes | Yes | Yes |
Related Pages
JavaScript Tutorial: JavaScript Errors
JavaScript Reference: The name property