cross browser console.log
By Anatoly Mironov
console.log
is the best tool for debugging javascript. In Firefox Firebug and Chrome Dev Tools you can even log objects which are represented as tree nodes of properties. If Firebug or Dev Tools in Chrome and IE9 are not opened, all these messages are ignored. But IE8 doesn’t understand console (if Dev Tools are closed) and raises an error: To avoid these errors, just declare an empty function just for IE8–:
var console = window.console || { log: function() {} };
Microsoft Ajax Library and console.log
In SharePoint and of course in ASP.NET we can use the built-in console tools: Sys.Debug.trace(“some message”);