Last active
September 20, 2022 19:49
-
-
Save giovannamoeller/3c3922b81831144f89de01c25fb36f43 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
| const array = [1, 2, 3, 4]; | |
| function getDoubledArray(array) { | |
| const arrayDoubled = []; | |
| for (let i = 0; i < array.length; i++) { | |
| const doubleValue = getDoubledValue(array[i]) | |
| arrayDoubled.push(doubleValue); | |
| } | |
| return arrayDoubled | |
| } | |
| function getDoubledValue(value) { | |
| return value * 2; | |
| } | |
| const arrayDoubled = getDoubledArray(array); | |
| console.log(arrayDoubled); // [2, 4, 6, 8] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment