let arr =[1,1,1,2,2,2,3,3,4,4,5,5];splice(arr)functionsplice(arr){for(let i =0,len=arr.length; i<len;i++){for(let j=len; j>i;j--){if(arr[i]===arr[j]){
arr.splice(j,1)}}}}
console.log(arr)
也可以用reduce方法去重
let arr =[1,3,4,5,6,4,10,89,1,2,2,3,3,4,4,4,4,4,4,];let newArr = arr.reduce((pre,cur)=>{if(!pre.includes(cur)){
pre.push(cur)}return pre.sort((a,b)=>{return a-b});},[]);
console.log(newArr);