Skip to main content

Code Golf · #24 · 2026-04-28

Convert to title case

Difficulty 2/3 · JavaScript

How to play

Write a JavaScript function body that passes all test cases using the fewest characters. Run against examples first, then submit for the full test suite. Eagle < Birdie < Par.

Given a string, convert to title case (first letter of each word uppercase, rest lowercase).

Examples

f("hello world") Hello World
f("jAVASCRIPT") Javascript

Loading your progress...

Your code (function body — receives input)

function(input) { 0 chars
}

Write the shortest JavaScript function body that passes all tests · Back to hub