HTML DOM console.log()Method
Definition and Usage
The console.log() method is used to output information in the console.
This method is helpful for testing during the development process.
Tip:When testing this method, the console needs to be visible (press F12 in the browser to open the console).
Syntax
console.log(message)
Browser Support
The numbers in the table indicate the first browser version that supports the method.
| Method | |||||
|---|---|---|---|---|---|
| console.log() | Yes | 8.0 | 4.0 | Yes | Yes |
Parameter Description
| Parameter | Type | Description |
|---|---|---|
| message | String or Object | Required. The information to be displayed on the console. |
More Examples
Example
Use an object as the output information:
var myObj = { name : "Example", site : "www.example.com" };
console.log(myObj);
Try it Yourself »
Example
Use an array as the output information:
var myArr = ["Google", "Taobao", "Example", "Facebook" ];
console.log(myArr);
Try it Yourself »
Console Object