Skip to content

Instantly share code, notes, and snippets.

@flexaddicted
Last active January 27, 2019 11:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save flexaddicted/277716641e3cce725b8419622092074f to your computer and use it in GitHub Desktop.
Save flexaddicted/277716641e3cce725b8419622092074f to your computer and use it in GitHub Desktop.
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