📌  相关文章
📜  javascript 按值降序对对象进行排序 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:34.495000             🧑  作者: Mango

代码示例4
javascript sort object by value descending


starWarsPeople.map(e=>{
    return e
  }).sort((a,b)=>{
    if (a.height-b.height>1) {return -1;}
    else if (a.height-b.height<1) {return 1;}
    else {return 0;}
  });