很多情况前端页面进行数据的筛选,这个时候用到了filter,等同map “映射”, 过滤以后原来数组不变。
语法:
var new_array=(function(element,index,arr), thisValue)
element 当前元素 必选
index 当前元素所在数组索引 非必选
arr 当前元素属于的数组对象 非必选
thisValue 在执行回调函数时定义的this对象 非必选
使用案例:
var tableReData=["1","add","ss","dddd","小学生"];
var reData= (function(item) {
return (tenText) > -1;
});