Skip to content

Instantly share code, notes, and snippets.

@magicmarkker
Created November 12, 2012 19:27
Show Gist options
  • Save magicmarkker/4061354 to your computer and use it in GitHub Desktop.
Save magicmarkker/4061354 to your computer and use it in GitHub Desktop.
Array Unique
Array.prototype.unique = function() {
var a, i, j, l;
a = [];
l = this.length;
i = 0;
while (i < l) {
j = i + 1;
while (j < l) {
if (this[i] === this[j]) {
j = ++i;
}
j++;
}
a.push(this[i]);
i++;
}
return a;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment