Created
September 11, 2019 21:32
-
-
Save jackpordi/3ed5b77871e2a3ca87a3fde3c624621e 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 myArray = [1, 4, 9, 16]; | |
function timesTwo(x) { | |
return x * 2; | |
} | |
// Pass the function to a map | |
const mappedArray = myArray.map(timesTwo); | |
// Expected output: Array [2, 8, 18, 32] | |
console.log(mappedArray); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment