Last active
January 27, 2019 11:11
-
-
Save flexaddicted/277716641e3cce725b8419622092074f 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
function number2String(number) { | |
return number.toString(10); | |
} | |
function myMap(numbers, fn) { | |
const elements = []; | |
for(let i = 0; i < numbers.length; i++) { | |
elements.push(fn(numbers[i])); | |
} | |
return elements; | |
} | |
const strings = myMap([1, 2, 3, 4], number2String); | |
console.log(strings); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment