SOURCE

let arr = [1,7,3,14]
arr.sort(function(a,b){
    return a-b
})
console.log(arr)

function arrSort(arr){
    for(let i =0;i<arr.length-1;i++){
        for(let j=i+1;j<arr.length;j++){
            if(arr[i]>arr[j]){
                let temp
                temp = arr[i]
                arr[i] = arr[j]
                arr[j] = arr[i]
            }
        }
    }
    return arr
}
console.log('for遍历',arrSort(arr))

let arr2 = [1,2,5,6,2,1]
let [...newArr] = new Set(arr2)
console.log(newArr)

function arrWay(arr){
    for(let i = 0;i<arr.length-1;i++){
        for(let j = i+1;j<arr.length;j++){
            if(arr[i]===arr[j]){
                arr.splice(j,1)
                j--
            }
        }
    }
    return arr
}
console.log(arrWay(arr2))


let newArrF = arr2.filter((item,index)=>{
 return arr2.indexOf(item) === index   
})
console.log('newArrF',arr2)
console 命令行工具 X clear

                    
>
console