首先接常规数组的
类似 [0,1,2,3,1,2]这种
const newArr = [...new Set(arr)]
然后是数组里是对象
类似 [ {name:“jack”},{name:“jone”},{name:“jack”} ]
const obj = {};
const newArr = arr.reduce((result,item)=>{
obj[item.name] ? "" : obj[item.name] = true && result.push(item);
return result;
},[])