Here you can find the source of distinct2()
Array.prototype.distinct2 = function(){ var _self = this; var _a = this.concat().sort(); console.log(_a);//from w ww. j a v a2 s . c o m _a.sort(function(a,b){ console.log("a: "+ a, "b: "+ b); if(a == b){ var n = _self.indexOf(a); _self.splice(n, 1); } }); return _self; }
Array.prototype.distinct = function () { var result = new Array(); this.forEach(x => { if (!result.contains(x)) result.push(x); }); return result; };
Array.prototype.distinct = function(){ var self = this var _array = [] self.forEach(function(e){ if(_array.contains(e)){ _array.push(e) }) return _array ...
Array.prototype.distinct = function () { var result = []; var hash = new Dictionary(); forEach(this, function (element) { if (!hash.contains(element)) { result.push(element); hash.store(element, element); }); ...
Array.prototype.distinct = function () { var sameObj = function (a, b) { var tag = true; if (!a || !b) return false; for (var x in a) { if (!b[x]) return false; if (typeof (a[x]) === 'object') { tag = sameObj(a[x], b[x]); ...
Array.prototype.distinct = function (comparer) { var arr = []; var l = this.length; for (var i = 0; i < l; i++) { if (!arr.contains(this[i], comparer)) arr.push(this[i]); return arr; }; ...