📅  最后修改于: 2022-03-11 15:03:45.849000             🧑  作者: Mango
var data = [{
"name": "Peter",
"age": 30,
"hair color": "brown"
}, {
"name": "Steve",
"age": 55,
"hair color": "blonde"
}, {
"name": "Steve",
"age": 55,
"hair color": "blonde"
}]
data = this.data.filter((obj, pos, arr) => {
return arr
.map(mapObj => mapObj.name)
.indexOf(obj.name) == pos;
});
console.log(data);
/*
[{
"name": "Peter",
"age": 30,
"hair color": "brown"
}, {
"name": "Steve",
"age": 55,
"hair color": "blonde"
}]
*/