Easy Tutorial
❮ Event Onmouseleave Prop Progress Value ❯

JavaScript Error name Property

JavaScript Error Object


Definition and Usage

The name property is used to set or return the error name.

The name property can return one of the following 6 different values:

Error Name Description Example
EvalError Error generated by the eval() function. Note: Modern JavaScript uses SyntaxError instead of EvalError.
RangeError Number is out of the specified range Try it
ReferenceError Illegal reference Try it
SyntaxError Syntax error Try it
TypeError Type error Try it
URIError Error generated by the encodeURI() function Try it

Tip: We can also refer to the message property to output more details about the error.

Syntax

errorObj.name

Parameter Explanation:

Return Value


Browser Support

Property
name Yes Yes Yes Yes Yes

Example

Return an error name ("adddlert" function is not defined):

try {
    adddlert("Welcome guest!");
}
catch(err) {
    document.getElementById("demo").innerHTML = err.name;
}

JavaScript Error Object

❮ Event Onmouseleave Prop Progress Value ❯