String Manipulation

Capitalize Words

easystringstring
0:00

Problem

Capitalize the first letter of every whitespace-separated word in the given sentence. All other letters should be lowercased.

Your solution
Test results
Click Run tests to check your solution against the test cases.

About this challenge

Capitalize Words is a easy string manipulation coding challenge. It tests string-manipulation techniques: parsing, transforming, and searching text efficiently. Write your solution in the editor above, run it against the test cases, and get instant feedback — free, in your browser, no sign-up.

Show a hint & approach (spoiler)

Hint: Split on spaces, map each word to word[0].toUpperCase() + word.slice(1).toLowerCase(), then join.

Keep practicing

Browse all coding challenges, or build intuition for the underlying concepts with the algorithm visualizers and the developer cheatsheets.