सरणी जावास्क्रिप्ट से डुप्लिकेट ऑब्जेक्ट्स निकालें
const addresses = [...]; // Some array I got from async call
const uniqueAddresses = Array.from(new Set(addresses.map(a => a.id)))
.map(id => {
return addresses.find(a => a.id === id)
})
ऑब्जेक्ट्स जावास्क्रिप्ट की सरणी से डुप्लिकेट निकालें
arr.filter((v,i,a)=>a.findIndex(t=>(t.place === v.place && t.name===v.name))===i)
सरणी कोणीय से डुप्लिकेट ऑब्जेक्ट्स निकालें
this.item = this.item.filter((el, i, a) => i === a.indexOf(el))
सरणी जावास्क्रिप्ट से डुप्लिकेट ऑब्जेक्ट्स निकालें
function remove_duplicate_objects(data,prop) {
var seen = {};
data = data.filter(function (entry) {
if (seen.hasOwnProperty(entry[prop])) {
return false;
}
seen[entry.prop] = entry;
return true;
});
return data
}
const new_array = remove_duplicate_objects([array with objects inside])