什么是jQuery中的console.log? [英] What is console.log in jQuery?

查看:366
本文介绍了什么是jQuery中的console.log?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能重复:

jQuery中使用的console.log是什么?

什么是 console.log ?在jQuery中使用了什么?

What is console.log? What is it used for in jQuery?

推荐答案

jQuery和 console.log 是不相关的实体,虽然在一起使用时很有用。

jQuery and console.log are unrelated entities, although useful when used together.

如果您使用浏览器的内置开发工具, console.log 将记录有关传递给 log 函数的对象的信息。

If you use a browser's built-in dev tools, console.log will log information about the object being passed to the log function.

如果控制台不活动,日志记录将无法正常工作,并可能会破坏您的脚本。请务必在登录前检查控制台是否存在:

If the console is not active, logging will not work, and may break your script. Be certain to check that the console exists before logging:

if (window.console) console.log('foo');

可能会看到以下快捷方式:

The shortcut form of this might be seen instead:

window.console&&console.log('foo');

还有其他有用的调试功能,例如 debug dir 错误。 Firebug的wiki列出了 console api 中的可用功能。

There are other useful debugging functions as well, such as debug, dir and error. Firebug's wiki lists the available functions in the console api.

这篇关于什么是jQuery中的console.log?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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