Skip to content

Instantly share code, notes, and snippets.

@rtmalone
Created July 14, 2017 16:39
Show Gist options
  • Select an option

  • Save rtmalone/27463f1d2f47bc5333948c89e37b7dd6 to your computer and use it in GitHub Desktop.

Select an option

Save rtmalone/27463f1d2f47bc5333948c89e37b7dd6 to your computer and use it in GitHub Desktop.
Deduplicate Array
// Filters duplicates from an array of Primitives (String, Bool, Num, null, undefined, Symbol)
const returnedArray = array
.map(obj => obj.name)
.filter((elem, idx, arr) => arr.indexOf(elem) === idx);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment