Created
September 21, 2017 09:21
-
-
Save alvaro-prieto/081cb49f2c29d7e04cfe79dac1ff610e to your computer and use it in GitHub Desktop.
Ejecutar una funcion sobre cada elemento de un array y retornar un nuevo array
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
let numbers = [1, 5, 10, 15]; | |
let doubles = numbers.map( x => x * 2); | |
//el original no se altera | |
//tambien se le puede pasar una funcion por parametro como referencia, obviamente | |
let raices= numbers.map(Math.sqrt); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment