Last active
March 19, 2017 13:40
-
-
Save Harsimran1/f0f83e7d204fff83974048b59b2233e4 to your computer and use it in GitHub Desktop.
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
var arr = [{"name":"John","age":10}, | |
{"name":"Ron","age":11}, | |
{"name":"Robin","age":12}, | |
{"name":"Sean","age":45}, | |
{"name":"Sarah","age":40} | |
]; | |
function sort(array){ | |
array.sort(function(a, b){ | |
return a.age - b.age; | |
}); | |
} | |
sort(arr); | |
console.log(arr) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment