📜  js中对象的降序 - Javascript代码示例

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

代码示例2
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;}
  });