编辑代码

const arr = [10, 23, 1, 33, 41, 2, 443, 50, 61, 49]


const sort = (nodes) => {
    if (nodes.length <= 1) return nodes
    const nodesIndex = Math.round(nodes.length / 2)

    const left = []
    const right = []

    nodes.forEach(i => {
        if (i < nodes[nodesIndex]) { left.push(i) } else {
            right.push(i)
        }
    })



    return sort(left).concat(right)

}

const a = sort(arr)

console.log(a)