Firebug is the best tool for debugging heavyweight javascript web applications. You can put console.log(arguments) here and console.debug(foo) there, but ... YOU SHOULD NEVER FORGET TO REMOVE IT! If you forget it, your application stops working in any browser that doesn't know those methods. To avoid this, just include this snippet:
if(!window.console || !window.console.firebug) {
window.console = {
debug: function(){},
log: function(){}
};
}
/Edit: I just found http://getfirebug.com/firebug/firebugx.js which is more complete:
if (!window.console || !console.firebug)
{
var names = ["log", "debug", "info", "warn", "error",
"assert", "dir", "dirxml", "group",
"groupEnd", "time", "timeEnd", "count",
"trace", "profile", "profileEnd"];
window.console = {};
for (var i = 0; i < names.length; ++i)
window.console[names[i]] = function() {}
}

Leave a comment