数组的各种处理场景
作者:互联网
1. Filter
基础定义: 菜鸟(https://www.runoob.com/jsref/jsref-filter.html),mdn(https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Array/filter)
用法示例: https://www.jianshu.com/p/b074d106bd07
筛选数组arr中所有大于4的元素并返回该数组
let arr = [1, 3, 5, 8]
let arrFilter = arr.filter(ele => ele > 4)
console.log(arrFilter) // [5, 8]
标签:arr,场景,数组,处理,www,ele,filter,https 来源: https://www.cnblogs.com/kymming/p/16427783.html