Practice Real Company Assessment Patterns • Latest 2025–2026 Mock Tests

Programming Exercises

Write a function to capitalize the first letter of each word in a string.

Easy

Problem Statement

Write a function to capitalize the first letter of each word in a string.

Sample Input

"hello world"

Sample Output

Hello World

Limits

Time: 2s · Memory: 256 MB

Code Editor
00:00
// Capitalize the first letter of each word function capitalizeWords(str) { return str; } console.log(capitalizeWords("hello world"));
Log in or sign up to run or submit your code.Log inSign up
Input
"hello world"
Expected Output
Hello World