Nodejs Array Has has(needle)

Here you can find the source of has(needle)

Method Source Code

Array.prototype.has = function(needle) {
    return $.inArray(needle, this) != -1;
};

Object.prototype._toString = function() {
    this.str = '';
    for (var prop in this)
    {/* w  ww .  ja  v  a 2s  .co m*/
        try
        {
            if (typeof(this[prop]) != "undefined")
            {
                this.str += prop + ': ' + this[prop] + "\n";
            }
            else
            {
                this.str += prop + ': "",' + "\n";
            }
        } catch(e) {}
    }    
    return this.str;
};

Related

  1. has()
    Array.prototype.has = function  {
      return this.indexOf(item) > -1
    
  2. has(e)
    Array.prototype.has = function(e) {
      for(var i = 0; i < this.length; i++)
        if((e.equals) ? e.equals(this[i]) : e === this[i])
          return true;
      return false;
    };
    
  3. has(elem)
    Array.prototype.has = function(elem) {
      return this.indexOf(elem) !== -1;
    };
    
  4. has(elm)
    Array.prototype.has = function(elm) {
      return~~ this.indexOf(elm);
    };
    
  5. has(item)
    "use strict";
    Array.prototype.has = function (item) {
        return this.indexOf(item) > -1;
    };
    
  6. has(needle)
    Array.prototype.has = function(needle)
        for (var i = 0; i < this.length; i++)
            if (this[i] == needle) return true;
        return false;
    };
    
  7. 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
    ...
    
  8. has(v)
    Array.prototype.has= function (v) {
        for (i = 0; i < this.length; i++) {
            if (this[i] == v) {
                return i;
        return false;
    
  9. has(v)
    Array.prototype.has=function(v) {
      for (i=0;i<this.length;i++) {
        if (this[i]==v) return i;
      return undefined;