1.Array.filter()-----筛选全部值
const users = [{name:'张三', age:30},{name:'李四', age:35},{name:'王5', age:12}];
const result = users.filter(user => user.age > 20); // [{name:'张三', age:30},{name:'李四', age:35}]
2.Array.find()-----筛选第一个值
const users = [{name:'张三', age:30},{name:'李四', age:35},{name:'王5', age:12}];
const found = users.find(user => user.age > 20); // {name:'张三', age:30}
3.let Array = [...new Set(Array)]-----数组去重
let userLists = ['张三','jaychou', '张三', '李四'];
let users = [...new Set(userLists)]; // ['张三','jaychou', '李四'];
4.通过Math.max() 配合map() 查询数组对象中的最值
const users = [{name:'张三', age:30},{name:'李四', age:35},{name:'王5', age:12}];
Math.max.apply(Math, users.map(user => user.age)) // 35 最小值只需要把max改成min
或 Math.max(...users.map(i=>i.age)) // 35 最小值只需要把max改成min
5.Array.some() Array.every() ---返回布尔值
//some()判断数组中是否有元素满足条件
//every()判断是否所有元素都满足条件
const users = [{name:'张三', age:30},{name:'李四', age:35},{name:'王5', age:12}];
users.some(user => user.age<20); // true
users.every(user => user.age<20); // false
6.Array.reduce() 方法进行统计
简单用法:求和和乘积
var arr = [1, 2, 3, 4];
var sum = arr.reduce((x,y)=>x+y)
var mul = arr.reduce((x,y)=>x*y)
console.log( sum ); //求和,10
console.log( mul ); //求乘积,24
复杂参考:JS数组reduce()方法详解及高级技巧 - 简书