Nodejs Array Has has(value)

Here you can find the source of has(value)

Method Source Code

Array.prototype.has = function(value){
  var cake = false;
    for(var i = 0; i < this.length; i++){
      if(this[i] == value){
        cake = true;// w  ww.  ja  va2  s  .  c  o  m
      }
    }
  return cake;
};

Related

  1. has(needle)
    Array.prototype.has = function(needle)
        for (var i = 0; i < this.length; i++)
            if (this[i] == needle) return true;
        return false;
    };
    
  2. 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
    ...
    
  3. has(v)
    Array.prototype.has= function (v) {
        for (i = 0; i < this.length; i++) {
            if (this[i] == v) {
                return i;
        return false;
    
  4. has(v)
    Array.prototype.has=function(v) {
      for (i=0;i<this.length;i++) {
        if (this[i]==v) return i;
      return undefined;
    
  5. 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;
    
  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, defaultValue)
    Array.prototype.has = function(value, defaultValue) {
      for (i = 0; i < this.length; i++)
        if (this[i].toLowerCase() == value) return this[i];
      return defaultValue;
    
  8. hasContain(val)
    Array.prototype.hasContain = function(val){
        for(var i = 0 ; i < this.length ; ++i){
            if(this[i] == val) return true ;
        return false ;
    
  9. hasItem(e)
    Array.prototype.hasItem = function(e)
        for(i=0;i<this.length && this[i]!=e;i++);
        return i;