Created
August 20, 2018 09:40
-
-
Save soichisumi/f97f0b6c7f9d2864dd18700f6431c572 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
let humans = new Array() | |
humans.push({ | |
name: "yoyo", | |
age: 26 | |
}) | |
humans.push({ | |
name: "test", | |
age: 55 | |
}) | |
humans.push({ | |
name: "nama", | |
age: 12 | |
}) | |
humans.push({ | |
name: "old", | |
age: 77 | |
}) | |
console.log(humans) | |
humans.sort((a, b)=> { | |
return a.age - b.age; | |
}) | |
console.log(humans) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment