index.js
function(needle) {
  // Per spec, the way to identify NaN is that it is not equal to itself
  var findNaN = needle !== needle;
  var indexOf;

  if (!findNaN && typeof Array.prototype.indexOf === "function") {
    indexOf = Array.prototype.indexOf;
  } else {
    indexOf = function(needle) {
      var i = -1,
        index = -1;

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

        if ((findNaN && item !== item) || item === needle) {
          index = i;
          break;
        }
      }

      return index;
    };
  }

  return indexOf.call(this, needle) > -1;
}
function(needle) {
  // Per spec, the way to identify NaN is that it is not equal to itself
  var findNaN = needle !== needle;
  var indexOf;

  if (!findNaN && typeof Array.prototype.indexOf === "function") {
    indexOf = Array.prototype.indexOf;
  } else {
    indexOf = function(needle) {
      var i = -1,
        index = -1;

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

        if ((findNaN && item !== item) || item === needle) {
          index = i;
          break;
        }
      }

      return index;
    };
  }

  return indexOf.call(this, needle) > -1;
}
function ( needle ) { // Per spec, the way to identify NaN is that it is not equal to itself var findNaN = needle !== needle ; var indexOf ; if ( ! findNaN && typeof Array . prototype . indexOf === "function" ) { indexOf = Array . prototype . indexOf ; } else { indexOf = function ( needle ) { var i = - 1 , index = - 1 ; for ( i = 0 ; i < this . length ; i ++ ) { var item = this [ i ] ; if ( ( findNaN && item !== item ) || item === needle ) { index = i ; break ; } } return index ; } ; } return indexOf . call ( this , needle ) > - 1 ; }
to check if all values in the array are same
to check if all values in the array are same