Javascript Array allSame()
allSame()
Array.prototype.allSame = function() { // and not null var that = this return that.every(function(e) { return e && (e === that[0]); });//from w w w . j a v a 2 s .com };