// 数组去重 arr:数组;key:根据数组中为key的键名去重
filterArr(arr, key) {
const hash = {};
return arr.reduce((ss, item) => {
hash[item[key]] ? '' : (hash[item[key]] = true && ss.push(item));
return ss;
}, []);
},
// 数组去重 arr:数组;key:根据数组中为key的键名去重
filterArr(arr, key) {
const hash = {};
return arr.reduce((ss, item) => {
hash[item[key]] ? '' : (hash[item[key]] = true && ss.push(item));
return ss;
}, []);
},
本文标题:一个简单的数组对象去重,方便cv
本文链接:https://www.haomeiwen.com/subject/vuwoxrtx.html
网友评论