Javascript Array remove(s)

Description

Javascript Array remove(s)


Array.prototype.remove = function(s) {
    var i = this.indexOf(s);
    if(i != -1) {
        this.splice(i, 1);/*  w  w w. ja va2s.com*/
    }
}

Javascript Array remove(s)

function textField_clear(field) {
    if (field.defaultValue == field.value) {
  field.value = '';
 } else if (field.value == '') {
  field.value = field.defaultValue;/*from w w w . j  a va  2s .  co  m*/
 }
}

Array.prototype.remove = function(s) {
 for (var i = 0; i <  this.length; i++) {
  if(s == this[i]) {
   this.splice(i, 1);
  }
 }
}

Javascript Array remove(s)

Array.prototype.remove = function(s) {
    var i = this.indexOf(s);
    if(i != -1) this.splice(i, 1);
}



PreviousNext

Related