Possible Duplicate:(可能重复:)
What is console.log
?(什么是console.log
?)
Possible Duplicate:(可能重复:)
What is console.log
?(什么是console.log
?)
jQuery and console.log
are unrelated entities, although useful when used together.(jQuery和console.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.(如果使用浏览器的内置开发工具, console.log
将记录有关传递给log
功能的对象的信息。)
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');
There are other useful debugging functions as well, such as debug
, dir
and error
.(还有其他有用的调试功能,例如debug
, dir
和error
。)