Skip to content

Instantly share code, notes, and snippets.

@hoodwink73
Created April 5, 2019 07:01
Show Gist options
  • Save hoodwink73/333da0ece46c2b257de1d5b51a839a6d to your computer and use it in GitHub Desktop.
Save hoodwink73/333da0ece46c2b257de1d5b51a839a6d to your computer and use it in GitHub Desktop.
Call it trickery or geekery, I am going to create a unique array using `filter` (thanks @getify)
const the_redundants = [1, 2, 2, 3, 4, 6, 6, 7, 7, 7, 8]
// this is posiible because indexOf always
// returns the left most index
const the_pures = the_redundants
.filter((n, index, arr) =>
arr.indexOf(n) === index
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment