HTML DOM console.groupCollapsed()Method
Example
Create a collapsed group in the console:
console.log("Example");
console.groupCollapsed();
console.log("Example, this is inside the collapsed group.");
Try it yourself »
Definition and Usage
The console.groupCollapsed() method is used to set collapsed group information. Any information output after this code will be inside the collapsed group.
Click the expand button to open the group information.
Tip:Use console.groupEnd()method to end the current group.
Tip:Useconsole.group()method to set non-collapsed group information.
Syntax
console.groupCollapsed(label)
Browser Support
The numbers in the table specify the first browser version that fully supports the method.
| Method | |||||
|---|---|---|---|---|---|
| console.groupCollapsed() | 6 | 11.0 | 9.0 | 5.1 | Yes |
Parameter Details
| 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.groupCollapsed();
console.log("Example, this is inside the group.");
console.groupEnd();
console.log("Out of the group!");
Try it yourself »
Example
Set a label for the group of messages:
console.log("Example");
console.groupCollapsed("ExampleLabel");
console.log("I am in the group with the specified label.");
Try it yourself »
Console Object