Console groupCollapsed()
Example
Create a collapsed group of messages in the console:
console.log("Hello world!");
console.groupCollapsed();
console.log("Hello again,
this time inside a collapsed group!");
Try it Yourself »
More examples below.
Definition and Usage
The groupCollapsed()
method starts a collapsed message group.
In the Console, click the expand button to open the new message group.
All new messages will now be written inside this group.
Syntax
console.groupCollapsed(label)
Parameters
Parameter | Description |
label | Optional. A label for the group. |
More Examples
End a group with console.groupEnd():
console.log("Hello world!");
console.groupCollapsed();
console.log("Hello again,
this time inside a collapsed group!");
console.groupEnd();
console.log("and we
are back.");
Try it Yourself »
Specify a label for the collapsed group:
console.log("Hello world!");
console.groupCollapsed("myLabel");
console.log("Hello again,
this time inside a collapsed group, with a label!");
Try it Yourself »
Browser Support
console.groupCollapsed()
is supported in all modern browsers:
Chrome | IE | Edge | Firefox | Safari | Opera |
Yes | 11 | Yes | Yes | Yes | Yes |