← Back to challenges

Emphasise the Words

JavaScriptHardstringsloopsregex

Instructions

Create a function that returns a capitalized version of the string passed. The first letter of each word in the string should be capitalized while the rest of each word should be lowercase.

Examples

emphasise("hello world") ➞ "Hello World"

emphasise("GOOD MORNING") ➞ "Good Morning"

emphasise("99 red balloons!") ➞ "99 Red Balloons!"

Notes

You won't run into any issues when dealing with numbers in strings.

javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Format Number with Comma(s) Separating Thousands