Easy Tutorial
❮ Dom Obj Event Prop Node Firstchild ❯

HTML DOM console.error() Method

Console Object

Example

Output error message to the console:


Definition and Usage

The console.error() method is used to output error messages to the console.

This method is helpful for testing during the development process.

Note: The console needs to be visible during testing (open the console in the browser by pressing F12).


Syntax

console.error(message)

Browser Support

The numbers in the table specify the first browser version that fully supports the method.

Method
console.error() Yes 8.0 4.0 Yes Yes

Parameter Values

Parameter Type Description
message String or Object Required. An error message, which can be a string or an object.

More Examples

Example

Using an object as the error message:

Example

Using an array as the error message:

Console Object

❮ Dom Obj Event Prop Node Firstchild ❯