js多条件判断的简写
2021-03-02 23:26
阅读:386
标签:javascrip asc clu log include 判断 多条件 java 简写 js多条件判断的简写 标签:javascrip asc clu log include 判断 多条件 java 简写 原文地址:https://www.cnblogs.com/luguankun/p/14306572.html // 非简写
let x = ‘a‘
if (x === ‘a‘ || x === ‘b‘ || x === ‘c‘ || x === ‘d‘) {
console.log(11111);
}
// 简写
let arr = [‘a‘, ‘b‘, ‘c‘, ‘d‘]
if (arr.includes(x)) {
console.log(11111);
}
评论
亲,登录后才可以留言!