I have an array of objects.
const arr = [
{ title: \"sky\", artist: \"Jon\", id: 1 },
{ title: \"rain\", artist: \"Paul\", id: 2 },
{ title: \"sky\", artis
You could take an object and filter with the value of the hash table.
const
array = [{ title: "sky", artist: "Jon", id: 1 }, { title: "rain", artist: "Paul", id: 2 }, { title: "sky", artist: "Jon", id: 1 }, { title: "rain", artist: "Paul", id: 2 }],
ids = array.reduce((r, { id }) => (r[id] = !(id in r), r), {}),
result = array.filter(({ id }) => ids[id]);
console.log(result);