Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save LuckyArdhika/3cc52e7faf6f7cbc84095307a8bf966b to your computer and use it in GitHub Desktop.
Save LuckyArdhika/3cc52e7faf6f7cbc84095307a8bf966b to your computer and use it in GitHub Desktop.
const arr = [
{label: 'All', value: 'All'},
{label: 'All', value: 'All'},
{label: 'Alex', value: 'Ninja'},
{label: 'Bill', value: 'Op'},
{label: 'Cill', value: 'iopop'}
]
var result = arr.reduce((unique, o) => {
if(!unique.some(obj => obj.label === o.label && obj.value === o.value)) {
unique.push(o);
}
return unique;
},[]);
console.log(result);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment