Easy Tutorial
❮ Prop Node Firstchild Met Element Queryselector ❯

JavaScript Error Object

Error Object

The Error object provides error information when an error occurs.

Example

In the following example, the try block contains an undefined function "adddlert". Executing it will cause an error, and the catch block will output the error information:

For more details on JavaScript errors, refer to: JavaScript Errors - throw, try, and catch


Error Object Properties

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

Non-Standard Error Object Properties

Mozilla and Microsoft have defined the following non-standard Error object properties:

fileName (Mozilla)
lineNumber (Mozilla)
columnNumber (Mozilla)
stack (Mozilla)
description (Microsoft)
number (Microsoft)

It is not recommended to use these properties as they are not supported by all browsers.

❮ Prop Node Firstchild Met Element Queryselector ❯