JavaScript console.group() Method

Create a group of messages in the console

Definition and Usage

The group() method starts a message group.

All new messages will be written inside this group.

Syntax

console.group(label)

Parameters

Parameter Description
label Optional.
A label for the group

More Examples

End a group with console.groupEnd():

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

Specify a label for the group:

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

Browser Support

console.group() is supported in all modern browsers:
Chrome IE Edge Firefox Safari Opera
Yes 11 Yes Yes Yes Yes