数组嵌套对象去重
1.简单数组去重
const arr1 = [1,2,3,1] [...new Set(arr1)]
2.复杂数组去重
var arr = [{ key: '01', value: '乐乐' }, { key: '02', value: '博博' }, { key: '03', value: '淘淘' },{ key: '04', value: '哈哈' },{ key: '01', value: '乐乐' }]; const obj = {}; const newarr =arr.filter(item => obj[item.key] ? '' : (obj[item.key] = true), );