【发布时间】:2016-01-02 05:33:07
【问题描述】:
是否有内置方法来检测逻辑或条件中的哪一半为真?
// foo would return true or false
if (thing1 === "3" || thing2 === foo()) {
// do something if thing1 is 3
// do something different if thing2 is true
};
或者我应该只使用两个嵌套的 if 块吗?
【问题讨论】:
标签: javascript loops if-statement conditional logical-operators