Skip to content

Instantly share code, notes, and snippets.

@isaaguilar
Last active May 16, 2017 07:27
Show Gist options
  • Save isaaguilar/66fad8aea2799739963d375b8cadc219 to your computer and use it in GitHub Desktop.
Save isaaguilar/66fad8aea2799739963d375b8cadc219 to your computer and use it in GitHub Desktop.
"Uniques only" push to array in JavaScript ES6 (slow)
const uniquePush = (arr, item) => {
if ( arr.indexOf(item) === -1) {
arr.push(item)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment