Posted By

agarcim on 07/02/12


Tagged

javascript arrays


Versions (?)

Remove item from array


 / Published in: JavaScript
 

URL: http://stackoverflow.com/questions/4825812/clean-way-to-remove-element-from-javascript-array-with-jquery-coffeescript

Remove the item from the array changing the length of the array.

  1. Array.prototype.remove = function(e) {
  2. var t, _ref;
  3. if ((t = this.indexOf(e)) > -1) {
  4. return ([].splice.apply(this, [t, t - t + 1].concat(_ref = [])), _ref);
  5. }
  6. };

Report this snippet  

You need to login to post a comment.