JavaScript高阶函数
JavaScript高阶函数
filter()函数
语法 filter( function(currentValue, index, arr), thisValue)
参数说明
currentValue 必须。 当前元素的值
index 可选。 当前元素的索引值
arr 可选。 原数组
thisValue 可选。 执行回调时使用,传递给回调函数,作为this的值
作用 过滤数组中的元素,返回一个新的数组
把传入的函数作用于每个元素,根据返回值
原创
2020-05-27 19:49:56 ·
305 阅读 ·
1 评论