Rates TodayNIFTY25,670-0.83%SENSEX83,630.7-0.83%Gold 24K ₹11,320.24/g down186.46Silver ₹134.77/g down2.72
InsightforGeeks

Capitalize each word

EasyStrings · JavaScript

The task

Write capitalizeWords(s) that returns s with the first letter of every word in upper case and the rest in lower case.

Words are separated by single spaces.

Examples

  • capitalizeWords("hello big world") returns "Hello Big World"

Your code runs in your browser, in a separate worker, and is never sent to us. Edit the function, then press Run tests. Your work is saved here as you type.

JavaScript

Stuck?