I have a piece of code for removing duplicates from an array of object in ES6 as follows
function removeDuplicates(myArr, prop) {
return myArr.filter((obj, pos, arr) => {
return arr.map(mapObj => mapObj[prop]).indexOf(obj[prop]) === pos;
});
}
I am trying to understand the map function here using ES5 standards. Is there any other way to better write the above code in ES5 format? Thanks in advance