Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Possible Duplicate:(可能重复:)

What is console.log ?(什么是console.log ?)

What is it used for in jQuery?(它在jQuery中用于什么?)   ask by user398993 translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
125 views
Welcome To Ask or Share your Answers For Others

1 Answer

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 .(还有其他有用的调试功能,例如debugdirerror 。)

Firebug's wiki lists the available functions in the console api .(Firebug的wiki列出了控制台api中的可用功能。)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...