views:

126

answers:

2

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...

+3  A: 

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

It's also good practice.

Steerpike
It seems error prone, to me. I like StuffMaster's solution better.
Chase Seibert
I mean it's simply good practice to remove debugging messages from any code before you deploy.
Steerpike
+8  A: 

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 :)

StuffMaster