var sim=[{name:"vinod",location:"asia",place:"simha"},{name:"ajay",location:"zyd", place:"aaa"},{name:"ram",location:"raj",place:"zzz"},
{name:"abhirma",location:"zyd",place:"aaa"},
{name:"ram",location:"raj",place:"zzz"}];
sim.sort(function(a, b){
return a.location.localeCompare(b.location);
});
console.log(sim);
答案 0 :(得分:0)
const unique = new Set(sim.map(a=> JSON.stringify(a)));
console.log(unique);
const newarr= Array.from(unique).map(b=>JSON.parse(b));
console.log(newarr)
变量“ unique”将返回唯一值并删除重复的值,变量“ newarr”将返回对象数组