SOURCE

function sortNumberBySort(a,b){
    // 将空值排在最后
    return (b.sort!= ''&& b.sort!= null) - (a.sort!= ''&& a.sort!= null) || a.sort- b.sort;
}
function sortNumberByAge(a,b){
    return a.age-b.age
}
const arr = [
    {sort: 1, age: 1, name: 'a'},
    {sort: 3, age: 2, name: 'b'},
    {sort: 4, age: 3, name: 'c'},
    {sort: '', age: 4, name: 'd'},
    {sort: 2, age: 5, name: 'e'},
]
let sortArr1=arr.sort(sortNumberBySort)

console.log(sortArr1) 
console 命令行工具 X clear

                    
>
console