function unique(data){
data = data || ];
var a = {};
for (var i=0; ivar v = data[i];
if (typeof(a[ v]) == '未定義'){
a[v] = 1;
}
};
data.length=0;
for (var i in a){
data[data.length] = i;
}
傳回資料;
}
函數檢定(){
var arr = [9,1,3, 8,7,7,6,6,5,7,8,8,7,4, 3,1];
var arr1 = unique(arr);
alert(arr1.join("," ));
}
檢定();