"Debug" Chrome 中的函数

"Debug" function in Chrome

可能是一个愚蠢的问题,但不知何故我最终得到了 Google Chrome 控制台中可用的 debug 函数,如果我尝试在控制台上打印它,我得到:

ƒ debug(function, condition) { [Command Line API] }

但是我完全无法 console.log 以任何方式从中获取一些东西,而且我无法在网上找到任何文档...
我已经在 Firefox 上对其进行了测试,我得到 Uncaught ReferenceError: debug is not defined 所以它不是跨平台的,但也许出于开发目的它可能会有所帮助

可能与 debugger; 有关?...

这记录在 Console Utilities API Reference:

debug(function)

When the specified function is called, the debugger is invoked and breaks inside the function on the Sources panel allowing to step through the code and debug it.

debug(getData);

Use undebug(fn) to stop breaking on the function, or use the UI to disable all breakpoints.

For more information on breakpoints, see Pause Your Code With Breakpoints.