Currently, I am utilizing the lodash uniqWith method to eliminate duplicate items with the same id from my array.
However, the lodash method retains the first duplicated item, whereas I actually want to keep the last duplicated item.
Is there a way to achieve this?
var result = _.uniqWith(editedData, function(arrVal, othVal) {
return arrVal.id === othVal.id;
});
console.log(result)