Nodejs Array Delete by Value del(val)

Here you can find the source of del(val)

Method Source Code

/*// w  ww  .  jav a 2  s  .co  m
 OpenBeerMap main.js | noemie.lehuby(at)gmail.com, Poilou | MIT Licensed
 contributors : nlehuby, Maxime Corteel, Poilou (labiloute)
*/

//This method deletes a given value in an array
Array.prototype.del = function(val){
    var index = this.indexOf(val);
    if(index > -1)
    {
        this.splice(index, 1);
    }
}

Related

  1. delRepeat()
    Array.prototype.delRepeat = function () {
            var temp = {}, len = this.length;
            for (var i = 0; i < len; i++) {
                var tmp = this[i];
                if (!temp.hasOwnProperty(tmp)) {
                    temp[this[i]] = "yes";
            var y = 0,result = [];
    ...
    
  2. delete(element)
    Array.prototype.delete = function(element)
         for (i=0;i<this.length;i++)
             if(this[i]==element)
                 this.splice(i,1);
    
  3. 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) {
    ...
    
  4. delete(value)
    Array.prototype.delete = function(value){
      return(this.filter(function(n){ return n != value; }));
    };