HTML DOM console.groupCollapsed() method
Example
Create a collapsed group of information on the console:
console
.
log
(
"
Runoob
"
)
;
console
.
groupCollapsed
(
)
;
console
.
log
(
"
Runoob, this is inside the collapsed group.
"
)
;
Try it »
Definition and Usage
The console.groupCollapsed() method is used to set a collapsed group of information; all information output after this code will be placed inside the collapsed group.
Click the expand button to open the grouped information.
Tip: Use console.groupEnd() method to end the current group.
Tip: Use console.group() method to set a non-collapsed group of information.
Syntax
console.groupCollapsed(label)
Browser support
The numbers in the table indicate the first browser version that supports this method.
| Method | |||||
|---|---|---|---|---|---|
| console.groupCollapsed() | 6 | 11.0 | 9.0 | 5.1 | Yes |
Parameter Description
| Parameters | Type | Description |
|---|---|---|
| label | String | Optional. The group label. |
More examples
Example
Use the console.groupEnd() method to end the group:
console
.
log
(
"
Runoob
"
)
;
console
.
groupCollapsed
(
)
;
console
.
log
(
"
Runoob, this is inside the group.
"
)
;
console
.
groupEnd
(
)
;
console
.
log
(
"
Out of the group!
"
)
;
Try it »
Example
Set a label for the information group:
console
.
log
(
"
Runoob
"
)
;
console
.
groupCollapsed
(
"
RunoobLabel
"
)
;
console
.
log
(
"
I am in the group with the specified label.
"
)
;
Try it »
Console object