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

📅  最后修改于: 2022-03-11 15:02:20.855000             🧑  作者: 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;}
  });