What is best practice for debugging in JavaScript?
debugging ? console.log('info') : null;
My question is the null
, what is standard practice for this in general, or in this debugging use case?
What is best practice for debugging in JavaScript?
debugging ? console.log('info') : null;
My question is the null
, what is standard practice for this in general, or in this debugging use case?
1 Answer
Reset to default 13In your case:
debugging && console.log('info');
This trick is based on the "short circuit" feature and I suppose this info might be useful: http://en.wikipedia/wiki/Short-circuit_evaluation