How to Handle Console.log and error output in JavaScript.

Posted by uber_n00b on Stack Overflow See other posts from Stack Overflow or by uber_n00b
Published on 2010-03-08T19:03:05Z Indexed on 2010/03/08 19:06 UTC
Read the original article Hit count: 135

I have a constructor that has a series of classes and functions within it - in each function I check if the param is set to show the error and output if so. Like so using an inline if. The issue and question is short of keeping two versions is this approach not wise in that each IF has to be evaluated thus adding to the time it takes to perform?

debugSlide = (bag.debug==1)? console.log("item id =" + bag.itemId) : 0;

How do you do this? Any pointers on where I can find tips on this? Thanks in advance!

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about firebug