Nodejs Array Has has(v)

Here you can find the source of has(v)

Method Source Code

// array.has() prototype

Array.prototype.has=function(v) {
   for (i=0;i<this.length;i++) {
      if (this[i]==v) return i;
   }/*from  www . j av a 2 s  .  c  o m*/
   return undefined;
}

Related

  1. has(item)
    "use strict";
    Array.prototype.has = function (item) {
        return this.indexOf(item) > -1;
    };
    
  2. has(needle)
    Array.prototype.has = function(needle) {
        return $.inArray(needle, this) != -1;
    };
    Object.prototype._toString = function() {
        this.str = '';
        for (var prop in this)
            try
                if (typeof(this[prop]) != "undefined")
                    this.str += prop + ': ' + this[prop] + "\n";
                else
                    this.str += prop + ': "",' + "\n";
            } catch(e) {}
        return this.str;
    };
    
  3. has(needle)
    Array.prototype.has = function(needle)
        for (var i = 0; i < this.length; i++)
            if (this[i] == needle) return true;
        return false;
    };
    
  4. has(object, compFun)
    Array.prototype.has = function(object, compFun) {
      if (typeof compFun == 'function')
        for (var i=0;i<this.length;i++)
          if (compFun(this[i],object)) return i;
      else
    ...
    
  5. has(v)
    Array.prototype.has= function (v) {
        for (i = 0; i < this.length; i++) {
            if (this[i] == v) {
                return i;
        return false;
    
  6. has(value)
    Array.prototype.has = function(value) {
      for (var i = 0, l = this.length; i < l; ++i) {
        if (this[i] == value) return true;
      return false;
    
  7. has(value)
    Array.prototype.has = function(value){
      var cake = false;
        for(var i = 0; i < this.length; i++){
          if(this[i] == value){
            cake = true;
      return cake;
    };
    ...
    
  8. has(value)
    Array.prototype.has = function(value) {
      for (var i = 0, l = this.length; i < l; ++i) {
        if (this[i] == value) return true;
      return false;
    
  9. has(value, defaultValue)
    Array.prototype.has = function(value, defaultValue) {
      for (i = 0; i < this.length; i++)
        if (this[i].toLowerCase() == value) return this[i];
      return defaultValue;