Problem 28

Capitalize first letter Recursion Challenge

Given an array of strings, return a new array where the first letter of each string is capitalized.

Function Signature

capitalizeFirst(array)

Parameters

  • array — an array of strings.

Output

Return an array of strings with the first character of each string uppercased.

Constraints

  • The function must use recursion.
  • The function should accept exactly one argument.

Examples

capitalizeFirst(['car', 'poop', 'banana'])
→ ['Car', 'Poop', 'Banana']

capitalizeFirst(["ceci", "n'est", "pas", "une", "pipe"])
→ ["Ceci", "N'est", "Pas", "Une", "Pipe"]