1.利用splice var arr = [1,2,3,4,5,6,7,8,9,9,8,7,6,5,4,3,2,1]; function repeat(arr){ for(var i = 0;i<arr.length;i++){ for(var j = i+1;j<arr.length;j++){ if(arr[i] == arr[j]){ arr.splice(j,1); j--; } } } return arr } console.log(repeat(arr)); //[1, 2, 3…