-
-
Save parzibyte/2cacf694e851107ae61384b7f3b3093a 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
const arreglo = [ | |
{ | |
"nombre": "Maggie", | |
"edad": 5, | |
}, { | |
"nombre": "Cuco", | |
"edad": 1 | |
}, | |
{ | |
"nombre": "Misifú", | |
"edad": 10 | |
}, | |
{ | |
"nombre": "Teddy", | |
"edad": 2 | |
} | |
]; | |
console.log("Antes de ordenar: ", arreglo); | |
arreglo.sort((unaMascota, otraMascota) => unaMascota.edad - otraMascota.edad); | |
console.log("Después de ordenar: ", arreglo); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment