Thursday, February 10, 2011

When using firebug, do I have to remove the console outputs when deploying?

Hi,

I am using firebug for debugging etc.

When I deploy, it seems as though I have to remove all the console.log statements from my javascript code?

When viewing on a browser that doesn't have firebug I am getting errors relating to console...

  • Yes, they will make IE error as IE does not have the console.

    It's also good practice.

    Chase Seibert : It seems error prone, to me. I like StuffMaster's solution better.
    Steerpike : I mean it's simply good practice to remove debugging messages from any code before you deploy.
    From Steerpike
  • I used this post to create a log function. It will avoid those errors.

    function log(string) {  
      if (window.console && window.console.firebug) {
        console.log(string);
      }
    }
    

    It's also easier to type :)

0 comments:

Post a Comment