Last active
June 9, 2018 00:43
-
-
Save OtavioBraga/7ed05f1358b6e026ff541b812e14b699 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
// Criamos um array | |
var myArray = [15,30,35] | |
// Criamos a função que será passada ao map | |
function double(item) { | |
return item * 2 | |
} | |
// Criamos o array que irá receber o resultado da função double | |
let doubles = [] | |
// Iteramos sobre o array inicial para executar a função double | |
for (var i = 0; i < myArray.length; i++) { | |
doubles.push(double(myArray[i])) | |
} | |
console.log(doubles) | |
// [30,60,70] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment