function uniqueData(a) {
var cache = [];
for(var x = 0; x < a.length; x++) {
if(x == 0) {
cache[x] = a[x];
} else {
for(var y = 0, alertDublicate = false; y < cache.length; y++) {
if(cache[y] == a[x]) alertDublicate = true;
if(y + 1 == cache.length && alertDublicate != true) cache.push(a[x]);
};
};
};
return cache;
};
uniqueData([1,2,2,3,9,9,2,5,7,8]);
Первая попытка.