方法一
將數(shù)組的當(dāng)前項和后一項進(jìn)行對比
var arr = [1,1,1,1,'q','1',6,1,2,2,2,5,'q',6,'q','q','d'];
removeRepeat(arr);
function removeRepeat(arr) {
for (var i = 0; i< arr.length; i++) {
for (var j = i+1; j < arr.length-1; j++) {
if(arr[i] === arr[j]){
arr.splice(j,1);
j--;
}
}
}
console.log(arr);
}