Skip to content

Instantly share code, notes, and snippets.

@jasdeepkhalsa
Created March 23, 2013 13:54
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • 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