1.es5做法
var array=[1,3,4,5,2,3,4,5,5,5];
var ob={};
var result=[];
array.forEach(function (a) {
var key=(typeof a)+a;
console.log(key)
if(!ob[key]){
ob[key]=true;
result.push(a)
}
console.log(result)
})
2.es6做法
let array = [1, 1, 1, 1, 2, 3, 4, 4, 5, 3];
let newarray = Array.from(new Set([1, 1, 1, 2, 3, 2, 4]));
console.log(newarray)