Skip to content

Instantly share code, notes, and snippets.

@yeco
Created March 11, 2010 17:15
Show Gist options
  • Select an option

  • Save yeco/329372 to your computer and use it in GitHub Desktop.

Select an option

Save yeco/329372 to your computer and use it in GitHub Desktop.
Array.prototype.unique = function () {
var r = new Array();
o:for(var i = 0, n = this.length; i < n; i++)
{
for(var x = 0, y = r.length; x < y; x++)
{
if(r[x]==this[i])
{
continue o;
}
}
r[r.length] = this[i];
}
return r;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment