Javascript Array removeValue(name, value)

Description

Javascript Array removeValue(name, value)



Array.prototype.removeValue = function(name, value){
   var array = $.map(this, function(v,i){
      return v[name] === value ? null : v;
   });//from  w  w w.  j  ava  2 s  . c o m
   this.length = 0; //clear original array
   this.push.apply(this, array); //push all elements except the one we want to delete
}



PreviousNext

Related