Here you can find the source of unique()
Array.prototype.unique = function () { var r = [];//w w w . jav a 2s.c o m o: for (var i = 0, n = this.length; i < n; i++) { for (var x = 0, y = r.length; x < y; x++) { if (r[x] == this[i]) { continue o; } } r[r.length] = this[i]; } return r; };
Array.prototype.unique = function() { return this.reduce(function(accum, current) { if (accum.indexOf(current) < 0) { accum.push(current); return accum; }, []); }; function mutation(arr) { ...
Array.prototype.unique = function() { var a = this.concat(); for(var i=0; i<a.length; ++i) { for(var j=i+1; j<a.length; ++j) { if(a[i] === a[j]) a.splice(j--, 1); return a; ...
Array.prototype.unique = function() this.sort(); var re=[this[0]]; for(var i = 1; i < this.length; i++) if( this[i] !== re[re.length-1]) re.push(this[i]); ...
Array.prototype.unique = function() { var n = {},r=[]; for(var i = 0; i < this.length; i++) { if ( this[i] && !n[this[i]]) { n[this[i]] = true; r.push(this[i]); return r; ...
Array.prototype.unique = function () { var obj, result = []; for (var i = 0, l = this.length; i < l; ++i) { obj = this[ i ]; if ( result.indexOf( obj ) < 0 ) { result[ result.length ] = obj; return result; };
Array.prototype.unique = function(){ var i,j,len = this.length,tempArr = [],tempLen,state; for(i = 0 ; i < len ; i++){ tempLen = tempArr.length; state = true; for(j = 0 ; j<tempLen;j++){ if(this[i] == tempArr[j]){ state = false; if(state){ tempArr.push(this[i]); return tempArr; };
Array.prototype.unique = function() { var r = []; this.each(function(key, value) { if (!r.contains(value)) { r.push(value); }); return r; }; ...
Array.prototype.unique = function() { var a = []; var l = this.length; for(var i=0; i<l; i++) { for(var j=i+1; j<l; j++) { if (this[i] === this[j]) j = ++i; a.push(this[i]); ...
Array.prototype.unique = function() { var aryToReturn = Array(); for (var i = 0; i < this.length; i++) { var val = this[i]; if (undefined === aryToReturn.findFirst(function() {return this == val})) { aryToReturn.push(val); return aryToReturn; ...