Javascript Array removeObject(obj)

Description

Javascript Array removeObject(obj)




Array.prototype.removeObject = function (obj) {
    if (this != undefined && this.constructor == Array) {
        var index = this.indexOf(obj)
        if (index > -1) {
            this.splice(index, 1);/*from   w w w.j  a  va  2  s  .  c  o m*/
        }
    }
}

Javascript Array removeObject(obj)

Array.prototype.removeObject = function(obj) {
  var index = this.indexOf(obj);
  if(index !== -1) {
    this.splice(index, 1);/*www . j  av a  2 s  .com*/
  }
}



PreviousNext

Related