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?
In 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.org/wiki/Short-circuit_evaluation
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.