如何使用jQuery将值记录到Firebug控制台?

我只是想知道是否有办法使用jQuery将一些变量值记录到Firebug控制台以进行调试?

jQuery只是一个JavaScript库,所以你可以使用console.log()函数:

 console.log(myVar); 
 (function($) { $.log = function() { if( 'console' in window ) console.log.apply(null, arguments); }; }(jQuery)); $.log("hello world, I'm just kidding with this answer, please upvote it anyway!"); $.log("You should really just call console.log() directly"); $.log("Over and out!"); 

它不是jquery,只是Firebug API:

 console.log(2,4,6,8,"foo",bar)