let data = [
{alarming: 1, count: 6},
{alarming: 0, count: 0},
{alarming: 1, count: 1},
{alarming: 0, count: 12},
{alarming: 1, count: 3},
{alarming: 0, count: 0},
{alarming: 0, count: 5}
];
data.sort((x, y) => {
if(x.alarming == y.alarming) {
return y.count - x.count;
}
return y.alarming - x.alarming;
});
网友评论