Created
          October 20, 2019 07:34 
        
      - 
      
 - 
        
Save gbols/b81ed7f5b5ada27b69ea0aee575e2807 to your computer and use it in GitHub Desktop.  
    Chaser 
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | const users = [ | |
| { | |
| name: "matt sanders", | |
| rank: 5 | |
| }, | |
| { | |
| name: "winifred bony", | |
| rank: 2 | |
| }, | |
| { | |
| name: "gbolahan olagunju", | |
| rank: 1 | |
| } | |
| ] | |
| const sortedbyRank = users.sort((a, b) => b.rank < a.rank); | |
| console.log(sortedbyRank) | |
| const sortedbyName = users.sort((a, b) => b.name < a.name); | |
| console.log(sortedbyName); | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment