Last active
April 29, 2017 03:57
-
-
Save sholadedokun/2bfbe680aced242475db26f613bcd825 to your computer and use it in GitHub Desktop.
Sorting Array of object
This file contains 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
let persons=[ | |
{ name:"Jude", age:30 }, | |
{ name:"Lily", age:25 }, | |
{ name:"Mark", age:34 }, | |
{ name:"Luke", age:18 }, | |
{ name:"John", age:55 }, | |
{ name:"Jack", age:12 } | |
] | |
sortedPersons=persons.sort((a, b)=> a.age - b.age) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment