Javascript Array removeSameEle(val)

Description

Javascript Array removeSameEle(val)


Array.prototype.removeSameEle = function(val) {
 var len = this.length;
 if (len > 0) {
  for ( var i = 0; i < len; i++) {
   var index = this.indexOf(val);
   if (index > -1) {
    this.splice(index, 1);/*w w  w  .ja v  a 2s  .co m*/
   }
  }
 }
};



PreviousNext

Related