javascript · BEGINNER · Public challenge

Title Case Words

Challenge

Capitalise the first letter of every word and lowercase the rest. Words are separated by one or more spaces, and the output uses exactly one space between words with no leading or trailing space.

Example
Input: hELLO wORLD
Output: Hello World

Input: One line of text with at least one word.
Output: The formatted text.
Constraints: |text| <= 1000

  • Strings
  • JavaScript

Browse all challenges