此页面由社区从英文翻译而来。了解更多并加入 MDN Web Docs 社区。

View in English Always switch to English

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 ⁨2015年7月⁩.

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

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

语法

js
group()
group(label)

参数

label

分组标签。

返回值

无(undefined)。

规范

Specification
Console
# group

浏览器兼容性

参见