如何在 Google Chrome JavaScript 控制台中打印调试消息? [英] How do I print debug messages in the Google Chrome JavaScript Console?

查看:48
本文介绍了如何在 Google Chrome JavaScript 控制台中打印调试消息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

请注意,JavaScript 控制台与 JavaScript 调试器不同;它们有不同的语法 AFAIK,因此 JavaScript 调试器中的 print 命令在这里不起作用.在 JavaScript 控制台中,print() 会将参数发送到打印机.

解决方案

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

<前>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.

这篇关于如何在 Google Chrome JavaScript 控制台中打印调试消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆