SOURCE

// 获取最小值
function getMinValueIndex (arr) {
    let minValue = arr[0]
    let minIndex = 0
    arr.forEach((o, i) => {
        if (o < minValue) {
            minValue = o
            minIndex = i
        }
    })
    return minIndex
}

// 升序
function ascendingOrder (arr) {
    const newArr = []
    const len = arr.length - 1
    for (let i = 0; i <= len; i++) {
        newArr.push(arr.splice(getMinValueIndex(arr), 1)[0])
    }
    return newArr
}

console.log(ascendingOrder([1,2,4,12,423,53,123]))

console.log(ascendingOrder([12,3,1232,354,45,56,768,786,564,32,0]))
console 命令行工具 X clear

                    
>
console