HTML tutorial
CSS3 tutorial
Bootstrap tutorial
JavaScript tutorial
JQuery tutorial
AngularJS tutorial
React tutorial
NodeJS tutorial
PHP tutorial
Python tutorial
Python3 tutorial
Django tutorial
Linux tutorial
Docker tutorial
Ruby tutorial
Java tutorial
C tutorial
C ++ tutorial
Perl tutorial
JSP tutorial
Lua tutorial
Scala tutorial
Go tutorial
ASP.NET tutorial
C # tutorial
Write an error to the console
The error()
method writes an error message to the console.
The console is useful for testing purposes.
Parameter | Description |
message | Required. The error message to write to the console. |
Use an object as the error message:
const myObj = {firstname:"John", lastname:"Doe"};
console.error(myObj);
Use an array as the error message:
const myArr = ["Orange", "Banana", "Mango", "Kiwi"];
console.error(myArr);
console.error()
is supported in all browsers:
Chrome | IE | Edge | Firefox | Safari | Opera |
Yes | 8-11 | Yes | Yes | Yes | Yes |