Console group()
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 »
console.group();
console.log("Hello again, this time inside a group!");
More examples below.
Description
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
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.");
Try it Yourself »
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!");
Try it Yourself »
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 | Edge | Firefox | Safari | Opera | IE |
Yes | Yes | Yes | Yes | Yes | 11 |