English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML DOM console.groupCollapsed() method

 JavaScript Console Object

console.groupCollapsed()The method indicates the start of a collapsed information group.

Withconsole.group()Different, newly created groups are collapsed. Users need to use the display button next to it to expand it and display the entries created in the group.

Callconsole.groupEnd()Return to the parent group.

Syntax:

console.groupCollapsed(label)
console.log("Hello!");
console.groupCollapsed();
console.log("Hello again, this time in the group!");
console.groupCollapsed();
console.log("Hello again, this time in another group!");
Test and see‹/›

Browser Compatibility

All browsers fully support the console.groupCollapsed() method:

Method
console.groupCollapsed()IsIsIsIsIs

Parameter Value

ParameterDescription
label(Optional) Group Label

More Examples

Call withlabel console.groupCollapsed():

console.log("Hello!");
console.groupCollapsed("Level 1");
console.log("Hello again, this time in the group!");
console.groupCollapsed("Level 2");
console.log("Hello again, this time in another group!");
Test and see‹/›

 JavaScript Console Object