Problem
function capitalize (string) {
  string[0].toUpperCase()
  return string
}
Solution

When we call toUpperCase, we’re assuming that we’re modifying the string that was passed into the function. However, since strings are primitive values, that means they’re immutable and can’t be modified once they’ve been created.

Instead of trying to modify the string directly, we need to return a new string after capitalizing the first character.

const capitalize = ([firstLetter, ...restOfWord]) => {
  return firstLetter.toUpperCase() + restOfWord.join('')
}