Last active
July 11, 2020 23:45
-
-
Save moisescastillo/457ef0ec25b3e7bbd97e53bd7cee75da to your computer and use it in GitHub Desktop.
JavaScript map method
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
// JS: map() method | |
let clientes = [ | |
{nombre: "Luis", edad: 22}, | |
{nombre: "Alberto", edad: 31}, | |
{nombre: "Eduardo", edad: 19} | |
]; | |
let foo = clientes.map(function(cliente) { | |
return cliente.nombre; | |
}); | |
let bar = clientes.map((cliente) => cliente.nombre); | |
console.log(foo); | |
// ["Luis","Alberto","Eduardo"] | |
console.log(bar); | |
// ["Luis","Alberto","Eduardo"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment