Skip to content

Instantly share code, notes, and snippets.

@jasdeepkhalsa
Created March 23, 2013 13:54
Show Gist options
  • Save jasdeepkhalsa/5227812 to your computer and use it in GitHub Desktop.
Save jasdeepkhalsa/5227812 to your computer and use it in GitHub Desktop.
De-duplicate an array in JavaScript
var arr = [1,1,2];
var arr = arr.filter(function (v, i, a) { return a.indexOf (v) == i }); // dedupe array
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment