<html>
<head>
<title>js过滤数组中重复 </title>
</head>
<body>
<script>
//过滤数组中重复 
var uniq = function (arr) {
var a = [], o = {}, i, v, len = arr.length;
if (len < 2) {
return arr;
}
for (i = 0; i < len; i++) {
v = arr[i];
if (o[v] !== 1) {
a.push(v);
o[v] = 1;
}
}
return a;
}
var x = new Array("www","dwwwcn","wwwdwwwcn","dwwwcn");
alert(x);
var y = uniq(x);
alert(y);
</script>
</body>
</html>