Javascript Array allValuesSame()

Description

Javascript Array allValuesSame()


//Add some useful functions to the array prototype

Array.prototype.allValuesSame = function() {
  for(var i = 1; i < this.length; i++)
  {/*from   w  ww . j  a  va2  s.co m*/
    if(this[i] !== this[0])
      return false;
  }

  return true;
}



PreviousNext

Related