标签:数组排序 数组 var ice bsp 排序 code console style
function fn(arr){ for(var i = 0; i < arr.length-1; i++){ for(var j = 0; j < arr.length-1-i; j++){ if(arr[j]<arr[j+1]){ var temp = arr[j]; arr[j] = arr[j+1]; arr[j+1] = temp; } } } for(var k = 0; k < arr.length; k++){ var c = arr[k]; for(var l = k+1; l < arr.length; l++){ if(arr[l] == c){ arr.splice(l, 1); l--; } } } return arr } var arr = [1, 2, 5, 6, 8, 9, 10, 6, 5, 7, 4, 3, 5] console.log(fn(arr))
标签:数组排序 数组 var ice bsp 排序 code console style
原文地址:https://www.cnblogs.com/webmc/p/9813542.html