SOURCE

let arr = [{id:1,val:20},{id:1,val:400},
{id:1,val:200},{id:1,val:10},{id:1,val:20},{id:1,val:10}]
function url (a,b) {
    return a.val - b.val
}
console.log(arr.sort(url))
console 命令行工具 X clear

                    
>
console