比如:a = [true, false, true, false],那么我想把 a 里面的求 ||(或),结果应该为 true,代码如何实现呢?
a = [true, false, true, false]
a
||
true
a.includes(true)不能满足需求吗
a.some(Boolean)
a.reduce((a,b) => a || b)
抖个机灵, 请乎当真
a = [true, false, true, false] var s = eval(a.join(" || ")) console.log(s)
a.fitter(Boolean)
a.includes(true)不能满足需求吗