Here you can find the source of same_values(arr)
function findMissing(arr1, arr2){ if((arr1.length) && (arr2.length) === 0){ return 0;//from ww w . j a va 2 s . c o m } if(arr1.same_values(arr2)){ return 0; } for(num = 0; num < arr2.length; num++){ if(isInArray(arr2[num], arr1) !== true) return arr2[num]; } } Array.prototype.same_values = function(arr) { if (this.length != arr.length) return false; for (var i = 0; i < arr.length; i++) { if (this[i].same_values) { //To test values in nested arrays if (!this[i].same_values(arr[i])) return false; } else if (this[i] !== arr[i]) return false; } return true; }; function isInArray(value, array) { return array.indexOf(value) > -1; }
Array.prototype.same = function() { for(var i = 1; i < this.length; i++) { if(this[i] !== this[0]) return false; return true;
Array.prototype.same = function(comparisons, unordered) { if (Object.prototype.toString.call(this) !== '[object Array]') { throw new TypeError("`this` must be Array, not " + typeof this); var arglen = arguments.length; if (arglen < 1) { throw new TypeError("`arguments` must have at least one comparison `Array`"); var firstarg = arguments[0]; ...
Array.prototype.same = function(obj) { var i = this.length; while (i--) { if (obj.contains(this[i])) { return false; };
Array.prototype.sameElementCount = function(arr) { var result = [], count = null; arr.sort(); for (var i = 0; i < arr.length;) { count = 1; for (var j = i + 1; j < arr.length; j++) { if (arr[i] == arr[j]) { count++; result.push([ arr[i], count ]); i += count; return result; };