Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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;}
  });
 
PREVIOUS NEXT
Tagged: #javascript #sort #object #descending
ADD COMMENT
Topic
Name
6+6 =