你怎么能缩短||?

时间:2017-10-14 23:47:34

标签: javascript if-statement

这是我的代码:

if (5 > 2 || 6 > 2 || 7 > 2) {
    console.log("Two is small");
} else {
    console.log("Two is big");
}

有没有办法缩短它?我正在寻找这样的东西(下面的代码不起作用):

if (5, 6, 7 > 2) {
    console.log("Two is small");
else {
    console.log("Two is big");
}

0 个答案:

没有答案
相关问题