Nodejs Array Include include(needle)

Here you can find the source of include(needle)

Method Source Code

Array.prototype.include = function(needle) {
    for (var i = 0; i < this.length; i++) {
        if (needle == this[i]) {
            true;//from w  ww  .  j av  a2s.  c o  m
        }
    }

    return false;
}

Related

  1. include()
    Array.prototype.include = function{
      return(this.indexOf(value) != -1);
    };
    
  2. include(item)
    Array.prototype.include = function(item) {
      for (var i = this.length; --i >= 0; )
        if (this[i] == item)
          return true;
      return false;
    };
    
  3. include(object)
    Array.prototype.include = function (object) {
      return this.filter((value) => {
        return JSON.stringify(value) === JSON.stringify(object);
      }).length > 0;
    };
    
  4. include(val)
    Array.prototype.include = function(val) {
      return this.index(val) !== null;
    };
    
  5. include(value)
    Array.prototype.include = function(value){
      return(this.indexOf(value) != -1);
    };
    
  6. include(value)
    Array.prototype.include = function(value){
      return this.indexOf(value) !== -1;