Encodera

Thanks for reading!

Donate to the site — we work hard for you.

JavaScript reference

console.group

Groups console messages into a collapsible, indented block.

Available since: Web API

Syntax

console.group(label) … console.groupEnd()

Parameters

ParameterTypeDescription
labelstringOptional. The group's title.

Return value

undefinedReturns nothing.

Examples

A group of messages (output in the browser console):

console.group('Order #42');
console.info('Items: 3');
console.info('Total: $27');
console.groupEnd();

Output:

Order #42
  Items: 3
  Total: $27

Notes

Every console.group() needs a matching console.groupEnd(). The console.groupCollapsed() variant starts the group collapsed. This example does not run on the site — open the browser console (F12).

See also

  • console.log — Prints values to the console.
  • console.table — Shows an array of objects as a table in the browser console.

In the tutorial

  • Debugging — How to find bugs in JavaScript: reading the error message, console.log and its variants, checking types, developer tools and debugger.

Thanks for reading!

Donate to the site — we work hard for you.