数组去重
作者:chrispy
var arr = [2, 3, 4, 4, 5, 2, 3, 6], arr2 = []; for (var i = 0; i < arr.length; i++) { if (arr2.indexOf(arr[i]) < 0) { arr2.push(arr[i]); } } console.log(arr2);
var arr = [2, 3, 4, 4, 5, 2, 3, 6],
arr2 = [];
for (var i = 0; i < arr.length; i++) {
if (arr2.indexOf(arr[i]) < 0) {
arr2.push(arr[i]);
}
}
console.log(arr2);