console 方法 debug() outputs a message to the web console at the "debug" log level. The message is only displayed to the user if the console is configured to display debug output.

注意: 此特征可用于 Web 工作者 .

句法

console.debug(obj1 [, obj2, ..., objN]);
console.debug(msg [, subst1, ..., substN]);
					

参数

obj1 ... objN

A list of JavaScript objects to output. The string representations of each of these objects are appended together in the order listed and output to the console.

msg
A JavaScript string containing zero or more substitution strings, which are replaced with subst1 透过 substN in consecutive order.
subst1 ... substN
JavaScript objects with which to replace substitution strings within msg . This gives you additional control over the format of the output. See 使用字符串代入 in console for a description of how substitutions work.

把文本输出到控制台 in the documentation of the console object for details.

规范

规范 状态 注释
控制台 API
The definition of 'console.debug()' in that specification.
实时标准 初始定义

浏览器兼容性

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. 更新 GitHub 上的兼容性数据
桌面 移动
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
debug Chrome Yes Edge 12 Firefox 4 IE Yes Opera ? Safari Yes WebView Android Yes Chrome Android Yes Firefox Android 4 Opera Android ? Safari iOS ? Samsung Internet Android Yes
Substitution strings Chrome Yes 注意事项
Yes 注意事项
In version 28, if a negative value is passed to %d , it will be rounded down to the closest negative integer. For example, -0.1 becomes -1.
Edge 12 注意事项
12 注意事项
Before Edge 79, %c 不支持。
Before Edge 79, %d outputs a 0 if the specified value isn't a number.
Firefox 9 IE 10 注意事项
10 注意事项
%c 不支持。
%d outputs a 0 if the specified value isn't a number.
Opera ? Safari ? WebView Android Yes 注意事项
Yes 注意事项
In version 28, if a negative value is passed to %d , it will be rounded down to the closest negative integer. For example, -0.1 becomes -1.
Chrome Android Yes 注意事项
Yes 注意事项
In version 28, if a negative value is passed to %d , it will be rounded down to the closest negative integer. For example, -0.1 becomes -1.
Firefox Android 9 Opera Android ? Safari iOS ? Samsung Internet Android Yes 注意事项
Yes 注意事项
In Samsung Internet 1.5, if a negative value is passed to %d , it will be rounded down to the closest negative integer. For example, -0.1 becomes -1.

图例

完整支持

完整支持

兼容性未知 ?

兼容性未知

见实现注意事项。

元数据

  • 最后修改:
  1. 控制台 API
  2. 控制台
  3. 方法
    1. assert()
    2. clear()
    3. count()
    4. countReset()
    5. debug()
    6. dir()
    7. dirxml()
    8. error()
    9. group()
    10. groupCollapsed()
    11. groupEnd()
    12. info()
    13. log()
    14. profile()
    15. profileEnd()
    16. table()
    17. time()
    18. timeEnd()
    19. timeLog()
    20. timeStamp()
    21. trace()
    22. warn()
  4. 控制台 API 相关页面
    1. Window.console
    2. WorkerGlobalScope.console

版权所有  © 2014-2026 乐数软件    

工业和信息化部: 粤ICP备14079481号-1