[英]Is “.then(function(a){ return a; })” a no-op for promises?
[英]JavaScript ternary operator calling function or no-op
在JavaScript中进行调试的最佳做法是什么?
debugging ? console.log('info') : null;
我的问题是null
,这是一般的标准做法,还是在这个调试用例中?
在你的情况下:
debugging && console.log('info');
这个技巧基于“短路”功能,我想这些信息可能有用: http : //en.wikipedia.org/wiki/Short-circuit_evaluation
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.