HTML DOM console.group()Method
Example
Create a group message in the console:
console.log("Example");
console.group();
console.log("Example, this is inside the group.");
Try it Yourself »
Definition and Usage
The console.group() method is used to set the starting position of a group message. All messages after this position will be written to the group.
Tip:Use console.groupEnd()method to end the current group.
Tip:Useconsole.groupCollapsed()method to hide the group message.
Syntax
console.group(label)
Browser Support
The numbers in the table specify the first browser version that fully supports the method.
| Method | |||||
|---|---|---|---|---|---|
| console.group() | Yes | 11.0 | 4.0 | 4.0 | Yes |
Parameter Description
| Parameter | Type | Description |
|---|---|---|
| label | String | Optional. The group label. |
More Examples
Example
Use the console.groupEnd() method to end the group:
console.log("Example");
console.group();
console.log("Example, this is inside the group.");
console.groupEnd();
console.log("Jumped out of the group!");
Try it Yourself »
Example
Set a label for the message group:
console.log("Example");
console.group("ExampleLabel");
console.log("I am inside the labeled group.");
Try it Yourself »
Console Object