let arr = [
{playerid: 1, score: 120, time: '00:24', count: 24},
{playerid: 2, score: 110, time: '00:16', count: 16},
{playerid: 3, score: 120, time: '00:24', count: 23},
{playerid: 4, score: 105, time: '00:15', count: 16},
{playerid: 4, score: 105, time: '00:18', count: 13}
]
先根据 score
降序排序,score
值相同的时候再以 count
降序排序
得到结果如下,求一方法
let arr = [
{playerid: 1, score: 120, time: '00:24', count: 24},
{playerid: 3, score: 120, time: '00:24', count: 23},
{playerid: 2, score: 110, time: '00:16', count: 16},
{playerid: 4, score: 105, time: '00:15', count: 16},
{playerid: 4, score: 105, time: '00:18', count: 13}
]
一行代码搞定~