Javascript Array my_includes(val)

Description

Javascript Array my_includes(val)


Array.prototype.my_includes = function(val) {
  for(var i = 0; i < this.length; i++) {
    if(this[i] === val) {
      return true;
    }// w  ww .j  a  v a  2 s. c om
  };
  return false;
}

 var grid = new Array(8)
  for (var i = 0; i < 8; i++){
    grid[i] = new Array(8);
  }

console.log(grid);
console.log([undefined].my_includes(undefined));



PreviousNext

Related