Answers for "descending order in objects in js"

1

descending order in objects in js

starWarsPeople.map(e=>{
    return e
  }).sort((a,b)=> b.height - a.height);
Posted by: Guest on May-20-2021
0

javascript sort object by value descending

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;}
  });
Posted by: Guest on May-17-2021

Code answers related to "descending order in objects in js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language