JavaScript ternary operator call function or no-op

What's best for JavaScript debugging?

debugging ? console.log('info') : null;

      

My question is null

, what is the standard practice for doing this at all, or in this case using debugging?

+3


source to share


1 answer


In your case:

debugging && console.log('info');



This trick is based on the "short circuit" function and I believe this information might be helpful: http://en.wikipedia.org/wiki/Short-circuit_evaluation

+8


source







All Articles