Array.prototype.unique = function() { return this.filter(function(value, index, _this) { return _this.indexOf(value) === index; }); } alert([1,2,3,3,3,4,5,6,7,7,8,3,4,5,6,1,4,5,8,9,3,2, 'q', 'q', 'aaaa'].unique());