let arr = [1,2,3,4,5,6]
let arr2 = arr.filter(function(arrItem,index,arr) {
console.log(arrItem, index, arr)
return arrItem>2
})
console.log(arr2, 'arr2')
filter过滤的使用
于 2023-06-28 11:13:07 首次发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)
let arr = [1,2,3,4,5,6]
let arr2 = arr.filter(function(arrItem,index,arr) {
console.log(arrItem, index, arr)
return arrItem>2
})
console.log(arr2, 'arr2')