其他分享
首页 > 其他分享> > sort排序

sort排序

作者:互联网

原文链接https://www.jianshu.com/p/6968f71ed5df
var objs = [
{name: ‘B’, num: 9},
{name: ‘C’, num: 2},
{name: ‘D’, num: 4},
{name: ‘B’, num: 5},
{name: ‘C’, num: 9},
{name: ‘E’, num: 6},
{name: ‘F’, num: 4},
{name: ‘F’, num: 12}
];
objs.sort((star,next)=>{
// return star.num - next.num
return next.num - star.num
})

标签:sort,objs,star,name,next,num,排序
来源: https://blog.csdn.net/weixin_43524577/article/details/122416467