Nodejs Array Delete by Value delete_value(v)

Here you can find the source of delete_value(v)

Method Source Code

Array.prototype.delete_value = function (v) {
    for (var i = 0; i < this.length; ++i) {
        if (this[i] = v) {
            this.slice(i, 1);/*from w ww  . j  a va  2 s.co m*/
            return true;
        }
    }
    return false;
}

Related

  1. delete(element)
    Array.prototype.delete = function(element)
         for (i=0;i<this.length;i++)
             if(this[i]==element)
                 this.splice(i,1);
    
  2. delete(item)
    Array.prototype.delete = function(item) {
      var index = -1;
      for (var i = 0; i < this.length; i++) {
        if (item === this[i]) {
          index = i;
          break;
      if (index != -1) {
    ...
    
  3. delete(value)
    Array.prototype.delete = function(value){
      return(this.filter(function(n){ return n != value; }));
    };
    
  4. deleteByValue(val)
    Array.prototype.deleteByValue=function(val){
        for (var i in this){
            if(this[i]===val){
                this.splice(i,1)
                break
    
  5. deleteByValue(value)
    Array.prototype.deleteByValue = function(value) {
        var pos = this.indexOf(value);
        this.splice(pos, 1);