标签:script for循环 去重 for stat nbsp doc bsp ++
<script>
var a = [1, 3, 2, 4, 5, 3, 2, 1, 4, 6, 7, 7, 6, 6];
//示例数组
var b = [];
for(var i = 0; i < a.length; i++) {
var status = 0;
for(var j = 0; j < b.length; j++) {
if(a[i] == b[j]) {
status = 1;
break;
}
}
if(status == 0) {
b.push(a[i]);
}
}
for(var x in b) {
document.write(b[x] + " ");
}
</script>
标签:script for循环 去重 for stat nbsp doc bsp ++
原文地址:http://www.cnblogs.com/cmzhphp2017/p/7648719.html