Here you can find the source of unique()
/* Keep only one occurrence of an element in the array. * Produce an ascending ordered array. */ Array.prototype.unique = function(){ this.sort((x,y) => x-y);/* ww w . j a v a 2s.c o m*/ for(var i=0; i<this.length-1; ){ if(this[i]==this[i+1]) this.splice(i,1); else i++; } return this; }
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; ...
Array.prototype.unique = function(){ var new_array = []; for (var i=0; i < this.length; i++) { if(!new_array.contains(this[i])) new_array.push(this[i]); return new_array;
Array.prototype.unique = function() var h = {}; var r = []; this.forEach(function (item) { h[item] = true; }); for (var item in h) r.push(item); return r;
Array.prototype.unique = function() { var uniqueArray = new Array(); for(var i = 0; i < this.length; i++) { for(var j = i+1; j < this.length+1; j++) { if (this[i] !== null && this[i] === this[j]) this[j] = null; for(i = 0; i < this.length; i++) { ...
Array.prototype.unique=function(a){ return function(){return this.filter(a)}}(function(a,b,c){return c.indexOf(a,b+1)<0 });
Array.prototype.unique = function(a) { return function(){return this.filter(a)}}(function(a,b,c){return c.indexOf(a,b+1)<0 });