English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
console.error()Method writes an error message to the console.
This console can be used for testing or debugging purposes.
console.error(message)
console.error("An error occurred");Test and see‹/›
All browsers fully support the console.error() method:
Method | |||||
console.error() | Yes | Yes | Yes | Yes | Yes |
Parameter | Description |
---|---|
Message | String or object to be written to the console |
This example writes an object to the console:
var myObj = { str: "Some text", id: 12 }; console.error(myObj);Test and see‹/›
This example writes an array to the console:
var arr = ["Item1", "Item2", "Item3", "Item4"]; console.error(arr);Test and see‹/›