Nodejs Array Has has(value, defaultValue)

Here you can find the source of has(value, defaultValue)

Method Source Code

Array.prototype.has = function(value, defaultValue) {
   for (i = 0; i < this.length; i++)
      if (this[i].toLowerCase() == value) return this[i];
   return defaultValue;
}

Related

  1. has(v)
    Array.prototype.has= function (v) {
        for (i = 0; i < this.length; i++) {
            if (this[i] == v) {
                return i;
        return false;
    
  2. has(v)
    Array.prototype.has=function(v) {
      for (i=0;i<this.length;i++) {
        if (this[i]==v) return i;
      return undefined;
    
  3. 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;
    
  4. 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;
    };
    ...
    
  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. hasContain(val)
    Array.prototype.hasContain = function(val){
        for(var i = 0 ; i < this.length ; ++i){
            if(this[i] == val) return true ;
        return false ;
    
  7. hasItem(e)
    Array.prototype.hasItem = function(e)
        for(i=0;i<this.length && this[i]!=e;i++);
        return i;    
    
  8. hasItem(item)
    Array.prototype.hasItem = function(item) {
      return this.indexOf(item) < 0 ? true : false;
    
  9. hasItem(search)
    Array.prototype.hasItem = function (search) {
        var i, l;
        if( this instanceof Array ) {
            l   = this.length;
            for (i=0; i<l; i++) { if(this[i] === search) { return i; } }
            return false;
        } else {
            return this;
    };