lesson-cover

Go Back

Variables & Functions

Letter Map

Write a function called solution that takes in 2 parameters, a string and a function, and returns combined result of the function being called with every character in the string.

fun = (e) => {
  return '9'
}
result = solution('hello', fun) // "99999"

fun = (e) => {
  return e + '123'
}
result = solution('blah', fun) // "b123l123a123h123"

Reminder for students with prior experience: you are not allowed to use for and while loops. Reason