Created
April 5, 2019 07:01
-
-
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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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