Posted By

ianmonge on 09/13/08


Tagged

javascript js array remove


Versions (?)

Remove an item of array


 / Published in: JavaScript
 

URL: http://ejohn.org/blog/javascript-array-remove/

  1. // Array Remove - By John Resig (MIT Licensed)
  2. Array.prototype.remove = function(from, to) {
  3. var rest = this.slice((to || from) + 1 || this.length);
  4. this.length = from < 0 ? this.length + from : from;
  5. return this.push.apply(this, rest);
  6. };

Report this snippet  

You need to login to post a comment.