I have an array of objects.
const arr = [ { title: \"sky\", artist: \"Jon\", id: 1 }, { title: \"rain\", artist: \"Paul\", id: 2 }, { title: \"sky\", artis
One way to do it, in order to avoid running an exponential loop is to save all values to a new object, and convert that object to a new array.
const combinedObj = arr.reduce((obj, item) => { obj[item.id] = item; return obj; }, {}); const newArray = Object.values(combinedObj)