1 var attr5 = [1, 4, 7, 1, 7, 9, 4, 6, 4, 0, 3, 7, 13, 16, 18, 13];
2 var attr6 = new Array();
3 for (var i = 0; i < attr5.length; i++) {
4 // document.write(attr5[i])
5 // console.log(i);、
// rep数组用于储存下标
6 var rep = [];
7 for (var j = i + 1; j < attr5.length; j++) {
8 // console.log(j);
9 // 使用下标来保存需要对比的数据
10 if (attr5[i] === attr5[j]) {
11 // 不等于时
12 // attr6.push(attr5[i]);
13 rep.push(j);
14 console.log(rep);
15 }
16 }
17 if (rep.length == 0) {
18 // 把后面对比没有重复的值添加到数组中
19 attr6.push(attr5[i]);
20 }
21 }
22 document.write(attr6)