我正在使用array.filter过滤以下数组

let array =   [[75, -5750, 115],
 [76, -5750, 115],
 [93, -5750, 115],
 [94, -5750, 115],
 [95, -5750, 115],
 [96, -5750, 115],
 [97, -5750, 115],
 [98, -5750, 115],
 [99, -5750, 115]]

var lucky = array.filter(a=>a[0]>75); //this works
console.log(lucky);


我想实现类似

var lucky = array.filter(a=>98>a[0]>75); //apply two condition //it returns whole array in this case


如何实现这一目标???

最佳答案

好像您想要的是logical and operator。像这样:

array.filter(a => 98 > a[0] && a[0] > 75);

07-24 18:46