/ Published in: JavaScript
Usage:
var a = ['a','a','a'];
var b = a.AllValuesSame(): //true
var a ['1','1','2'];
var b = a.AllValuesSame(); //false
var a = ['a','a','a'];
var b = a.AllValuesSame(): //true
var a ['1','1','2'];
var b = a.AllValuesSame(); //false
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
Array.prototype.AllValuesSame = function(){ if(this.length > 0) { for(var i = 1; i < this.length; i++) { if(this[i] !== this[0]) return false; } } return true; }