首页 » node.js » 正文

使用JavaScript对json数组的各种处理方法 filter map forEach..

filter方法介绍

语法:array.filter(function(currentValue,index,arr), thisValue)

参数 用处
function(currentValue,index,arr) 每个元素都回调用该方法
currentValue 必须。当前元素的值
index 可选。当前元素的索引值
arr 可选。 当前元素属于的数组对象
thisValue 可选。对象作为该执行回调时使用,传递给函数,用作 “this” 的值。如果省略了 thisValue ,”this” 的值为 “undefined”

发表评论