console:clear() 静态方法
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.clear()
方法会清空控制台,但前提是该控制台允许清空。像浏览器运行的图形控制台就允许清空,而像 Node 运行的终端上显示的控制台则不支持它,调用该方法将不会产生任何效果(也不会报错)。
语法
js
clear();
参数
无
返回值
无(undefined
)。
规范
Specification |
---|
Console # clear |
浏览器兼容性
Report problems with this compatibility data on GitHubdesktop | mobile | server | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
clear() static method |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.