Last active
January 6, 2023 13:20
-
-
Save jleonelpm/2d9b9b6ad0d0e274b4d7658878836e76 to your computer and use it in GitHub Desktop.
Iterando array de objetos
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 lista = [ | |
{ | |
nombre : "Juan", | |
apellido : "Perez", | |
edad : 25 | |
}, | |
{ | |
nombre : "Maria", | |
apellido : "Lopez", | |
edad : 24 | |
}, | |
{ | |
nombre : "Ana", | |
apellido : "Perez Lopez", | |
edad : 8 | |
} | |
]; | |
const columns = ["Nombre", "Apellido", "Edad"] | |
console.log(columns.join("\t")); | |
//Iterando la lista de objetos con el operador map | |
lista.map((item) => { | |
console.log([item.nombre, item.apellido, item.edad].join("\t")); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment