English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
console.warn()Method writes a warning message to the console.
Typically, warnings are in a yellow background in the Web console log and are accompanied by a small exclamation mark icon.
This console can be used for testing or debugging purposes.
console.warn(message)
console.warn("This is a warning message!!!");Test and see‹/›
All browsers fully support the console.warn() method:
Method | |||||
console.warn() | 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.warn(myObj);Test and see‹/›
This example writes an array to the console:
var arr = ["Item1", "Item2", "Item3", "Item4"]; console.warn(arr);Test and see‹/›