This particular post on Stack Overflow discusses a method for retrieving all distinct values from a JavaScript array by eliminating duplicates. One of the answers presents this solution using ES6 syntax, which utilizes arrow functions and spread operators. However, I am seeking assistance in converting this code to ES5 without the use of arrows or ellipses.
var objArr = [{
id: '123'
}, {
id: '123'
}, {
id: '456'
}];
objArr = objArr.reduce(function(acc, cur) {
return acc.filter(function(obj) {
return obj.id !== cur.id;
}).concat(cur);
}, []);
console.log(objArr);