![](/img/trans.png)
[英]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.