同一个数组查重 let array=[1,2,5,4,1,2] array.forEach((ele,index)=> { if(array.indexOf(ele) !== index){ console.log(ele) } })