Answers for "remove duplicate objects based on an id in array javascript"

0

remove duplicates objects from array javascript

arr.reduce((acc, current) => {
  const x = acc.find(item => item.id === current.id);
  if (!x) {
    return acc.concat([current]);
  } else {
    return acc;
  }
}, []);
Posted by: Guest on November-09-2020

Code answers related to "remove duplicate objects based on an id in array javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language