Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save johnhutchins/554bd4b75bc6afd4cc3ad588b7d199c4 to your computer and use it in GitHub Desktop.
Save johnhutchins/554bd4b75bc6afd4cc3ad588b7d199c4 to your computer and use it in GitHub Desktop.
function removeDuplicatetElevations(arr){
console.log("NON FILTERED === ", arr)
const filteredArr = arr.reduce((acc, current) => {
const x = acc.find(item => item['height'] === current['height']);
if (!x) {
return acc.concat([current]);
} else {
return acc;
}
}, []);
console.log('FILTERED === ',filteredArr)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment