let objArr=[
{"s","dakjsdm"},
{"ss","dajshdkads"},
{"s","dgjsahd"},
{"ss","dakjsdgaddm"},
] ;
function objArray(objarray){
let len=objarray.length;
let tem={};
let res=[];
for(var i=0;i<len;i++){
// 取出每一个对象
tem[JSON.stringify(objaeeat[i] )]=true;
}
let key=Object.keys(tem);
for(var k=0;k<key.length;k++){
res.push(JSON.parse(key[k]);
}
return res
}
let res1=objArray(objArr);
console.log(res1)
网友评论