Javascript Array includes(search)

Description

Javascript Array includes(search)


Array.prototype.includes = function(search) {

 for ( var i = 0; i < this.length; i++ ) {
  
  if ( this[i] === search ) {

   return true;//from  w ww . j  a v  a2  s  . c  o m

  }

 }

  return false;

};

Javascript Array includes(search)

Array.prototype.includes = function(search) {
  for (var i = 0; i < this.length; i++) {
    if (search === this[i]){
      return true;
    }//  w  w  w. j  ava2  s. c o m
  }
  return false
}



PreviousNext

Related