JavaScript Error message
Example
Return an error message:
try {
adddlert("Welcome guest!");
}
catch(err) {
document.getElementById("demo").innerHTML = err.message;
}
Try it Yourself »
Definition and Usage
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 (ES1) feature.
ES1 (JavaScript 1997) is fully supported in all browsers:
Chrome | IE | Edge | Firefox | Safari | Opera |
Yes | Yes | Yes | Yes | Yes | Yes |
Related Pages
JavaScript Tutorial: JavaScript Errors
JavaScript Reference: The name property