Write a JavaScript function that capitalizes the given words. You need to make every word’s first letter – uppercase and all other letters – lowercase.
The input comes as a single string, containing words, separated by a space. Note: The words can contain any ASCII character. You need to affect only the letters.
Examples:
Input:
Capitalize these words
Output:
Capitalize These Words
Input:
Was that Easy? tRY thIs onE for SiZe!
Output:
Was That Easy? Try This One For Size!
The output is the same string, however with all of its words capitalized.