console:group() 静态方法

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

console.group() 方法在 Web 控制台上创建一个新的分组。随后输出到控制台上的内容都会被添加一个缩进,表示该内容属于当前分组,直到调用 console.groupEnd() 之后,当前分组结束。

备注: 此特性在 Web Worker 中可用。

语法

js
group()
group(label)

参数

label

分组标签。

返回值

无(undefined)。

规范

Specification
Console
# group

浏览器兼容性

Report problems with this compatibility data on GitHub
desktopmobileserver
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Deno
Node.js
group() static method

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

参见