Nodejs Array Contain contains(x)

Here you can find the source of contains(x)

Method Source Code

Array.prototype.contains=function(x){
 for(i in this){//from ww  w .jav  a2s .com
   if((x.city==this[i].city || x.firstName==this[i].firstname || x.lastName==this[i].lastname))
     return true;
   }
 return false;
}

Related

  1. contains(value)
    Array.prototype.contains = function(value) {
        return (this.indexOf(value) > -1);
    
  2. contains(value)
    "use strict";
    Array.prototype.contains = function(value){
      var n = this.length
      for (var i = 0; i < n; i++){
        if (this[i] == value) return true
      return false
    
  3. contains(value)
    Array.prototype.contains = function(value) {
      return this.indexOf(value) !== -1;
    };
    Array.prototype.remove = function(value) {
      var index = this.indexOf(value);
      if ( index !== -1 ) {
        this.splice(index, 1);
    };
    ...
    
  4. contains(value)
    Array.prototype.contains = function(value) {
      for(var i=0; i < this.length; i++) {
        if(this[i] === value)
              return true;
      return false;
    };
    
  5. contains(what)
    Array.prototype.contains = function (what) {
      var contains = false;
      if (typeof what !== 'function') {
        this.forEach(function (item) {
          if (contains) return;
          contains = (item === what);
        });
        return contains;
      this.forEach(function (item) {
        if (contains) return;
        contains = what(item);
      });
      return contains;
    };
    
  6. contains(x)
    Array.prototype.contains = function (x) {
        return this.indexOf(x) > -1;
    };
    
  7. containsAll(c)
    Array.prototype.containsAll = function(c) {
        for (var i = c.length - 1; i >= 0; i--) {
            if (!this.contains(c[i])) {
                return false;
        return true;
    };
    
  8. containsAll(elements)
    Array.prototype.containsAll = function(elements) {
      for (var i = 0; i < elements.length; i++) {
        if (!this.contains(elements[i])) {
          return false;
      return true;
    };
    
  9. containsAll(items)
    Array.prototype.containsAll = function(items)
      for(var i = 0; i<items.length; i++) {
        if(this.indexOf(items[i]) == -1)
          return false;
      return true;
    };