Capitalize

  • string

Write a function that accepts a string. The function should capitalize the first letter of each word in the string then return the capitalized string.

Capitalize
Examples:
  • capitalize('hello') -> 'Hello';
  • capitalize('world') -> 'World';
  • capitalize('a short sentence') -> 'A Short Sentence';
  • capitalize('this is a test') -> 'This Is A Test';

Write your solution

Loading...