HTML DOM console.group() method

Definition and usage

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

From now on, all messages will be written to this group.

Tip:Please use console.groupEnd() method End the group.

Tip:Please use console.groupCollapsed method Hide message groups (default collapsed).

Instance

Example 1

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

Example 2

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

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 3

Specify a label for message groups:

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

Try it yourself

Syntax

console.group(Label)

Parameter value

Parameter Type Description
Label String Optional. Group label.

Browser support

The numbers in the table indicate the first browser version that fully supports this method.

Method Chrome IE Firefox Safari Opera
console.group() Support 11.0 4.0 4.0 Support