HTML DOM console.warn() Method
Definition and Usage
The console.warn() method writes a warning to the console.
Tip: When testing this method, be sure to have the console view visible (press F12 to view the console).
Browser Support
The numbers in the table specify the first browser version that fully supports the method.
Method | |||||
---|---|---|---|---|---|
console.warn() | Yes | 8.0 | 4.0 | Yes | Yes |
Syntax
console.warn(message)
Parameter Values
Parameter | Type | Description |
---|---|---|
message | String or Object | Required. The message or object to write as a waringr |
More Examples
Example
Use an object as the warning message:
var myObj = { firstname : "John", lastname : "Doe" };
console.warn(myObj);
Try it Yourself »
Example
Use an Array as the warning message:
var myArr = ["Orange", "Banana", "Mango", "Kiwi" ];
console.warn(myObj);
Try it Yourself »