且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在 Google Chrome JavaScript 控制台中打印调试消息?

更新时间:2022-11-07 12:50:45

从浏览器地址栏执行以下代码:

javascript: console.log(2);

成功地将消息打印到 Google Chrome 中的JavaScript 控制台".

How do I print debug messages in the Google Chrome JavaScript Console?

Please note that the JavaScript Console is not the same as the JavaScript Debugger; they have different syntaxes AFAIK, so the print command in JavaScript Debugger will not work here. In the JavaScript Console, print() will send the parameter to the printer.

Executing following code from the browser address bar:

javascript: console.log(2);

successfully prints message to the "JavaScript Console" in Google Chrome.