Javascript best practice: handling Firebug-specific code

firebug, javascript, jquery

Solution

If you leave console.log() calls in your production code, then people visiting the site using Internet Explorer will have JavaScript errors. If those people have extra debugging tools configured, then they will see nasty dialog boxes or popups.

A quick search revealed this thread discussing methods to detect if the Firebug console exists: http://www.nabble.com/Re:-detect-firebug-existance-td19610337.html

Problem

Firebug is certainly a wonderful tool for javascript debugging; I use console.log() extensively. I wanted to know if I can leave the Firebug-specific code in production. What's the best practice? Commenting the debug code?

Original source