Skip to content

Instantly share code, notes, and snippets.

@eerne
Created June 4, 2009 09:44
Show Gist options
  • Save eerne/123542 to your computer and use it in GitHub Desktop.
Save eerne/123542 to your computer and use it in GitHub Desktop.
Array.remove()
Array.implement({
remove: function(i) {
var iSplat = $splat(i);
return this.filter(function(item, index){
return !iSplat.contains(index);
});
}
});
console.log( ['a', 'b', 'c', 'd'].remove(1) ) // returns ['a', 'c', 'd']
console.log( ['a', 'b', 'c', 'd'].remove([1, 2]) ) // returns ['a', 'd']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment