方法一
var arr=[1,2,5,1,26,1,2,26];
var newArr=[];
for (var i in arr){
if (newArr.indexOf(arr[i])==-1){//判断数组newArr内有没有此元素
newArr.push(arr[i]);
}
}
console.log(newArr);
方法二:利用set
let arr = [56, 78, 45, 56, 78, 90, 90];
arr = [...new Set(arr)];
console.log(arr);