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 »
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 |
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 »
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 »
Browser Support
console.group()
is supported in all modern browsers:
Chrome | Edge | Firefox | Safari | Opera | IE |
Yes | Yes | Yes | Yes | Yes | 11 |
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.