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]; le