const people = [
{ id: 73334, country: 'Sweden' },
{ id: 73335, country: 'England' },
{ id: 45445, country: '' },
{ id: 98064, country: 'England' },
{ id: 73414, country: 'Sweden' },
{ id: 4544500 },
{ id: 134616, country: 'Sweden' },
{ id: 139503, country: 'Sweden' },
{ id: 88989, country: 'France' },
];
const arr = [
{ id: 73334, country: 'Sweden' },
{ id: 73335, country: 'England' },
{ id: 88989, country: 'France' },
];
people.filter((n, i, a) => n.country && i === a.findIndex(m => m.country === n.country))
people.filter((n, i, a) => n.country && n === a.find(m => m.country === n.country))
people.filter(function({ country: n }) {
return n && !(this[n] = this.hasOwnProperty(n));
}, {})
Object.values(people.reduce((acc, n) => (n.country && (acc[n.country] = n), acc), {}))
[...people.reduce((acc, n) => n.country ? acc.set(n.country, n) : acc, new Map).values()]
Array.from(
new Set(people.map(n => n.country).filter(Boolean)),
n => people.find(m => m.country === n)
)
const countries = people.map(el => el.country);
people.filter((el, index) => countries.indexOf(el.country) === index)
/* [
{"id":73334,"country":"Sweden"},
{"id":73335,"country":"England"},
{"id":45445,"country":""}, // про пустые и отсутсвующие страны надо уточнить
{"id":4544500},
{"id":88989,"country":"France"}
]
*/