Javascript Dedup an Array
Here is a simple javascript function do remove the duplicate values in an array. It worked very well for what I needed it for, although it may not be full proof for your application.
function dedupArray(array)
{
array.sort();
var cnt = array.length – 1;
var i=0;
var keepers = new Array();
while(i <= cnt){
if(array[i] != array[i + 1]){
keepers.push(array[i]);
i++;
}else{
array.shift();
}
cnt = array.length – 1;
}
return keepers;
}