Created
August 16, 2016 19:09
-
-
Save manute/1c25665da2f7b4a2fee8a59815c76d62 to your computer and use it in GitHub Desktop.
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
var persons = [ | |
{ name: 'Jhon', age: 21 }, | |
{ name: 'Alice', age: 37 }, | |
{ name: 'Brenda', age: 45 }, | |
{ name: 'Manuel', age: 12 }, | |
{ name: 'Maria', age: 37 } | |
]; | |
function sortByAge(persons) { | |
return persons.sort(function(a, b){ | |
return a.age - b.age; | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment