Skip to content

Instantly share code, notes, and snippets.

@luokebi
Created July 6, 2012 01:46
Show Gist options
  • Save luokebi/3057531 to your computer and use it in GitHub Desktop.
Save luokebi/3057531 to your computer and use it in GitHub Desktop.
delete a item in a indexed array
//delete a item in indexed array
Array.prototype.remove=function(dx)
{
if(isNaN(dx)||dx>this.length){return false;}
for(var i=0,n=0;i<this.length;i++)
{
if(this[i]!=this[dx])
{
this[n++]=this[i]
}
}
this.length-=1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment