Javascript Array my_uniq()
Array.prototype.my_uniq = function() { uniques = [];//ww w. j ava 2s. com for(i = 0; i < this.length; i++){ if (uniques.indexOf(this[i]) === -1) { uniques.push(this[i]); }; }; return uniques; } // a = [1, 2, 3, 4, 2, 2, 4]; // console.log(a.my_uniq());