THE WORLD'S LARGEST WEB DEVELOPER SITE

HTML DOM console.group() Method

❮ Console Object

Example

Create a group of messages in the console:

console.log("Hello world!");
console.group();
console.log("Hello again, this time inside a group!");
Try it Yourself »

Definition and Usage

The console.group() method indicates the start of a message group.

All messages will from now on be written inside this group.

Tip: Use the console.groupEnd() method to end the group.

Tip: Use the console.groupCollapsed() method to hide the message group (collapsed by default).


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

Syntax

console.group(label)

Parameter Values

Parameter Type Description
label String Optional. A label for the group

More Examples

Example

End a group by using the console.groupEnd() method:

console.log("Hello world!");
console.group();
console.log("Hello again, this time inside a group!");
console.groupEnd();
console.log("and we are back.");
Try it Yourself »

Example

Specifying a label for the message group:

console.log("Hello world!");
console.group("myLabel");
console.log("Hello again, this time inside a group, with a label!");
Try it Yourself »

❮ Console Object