Remove an item of array


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  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. };

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.