JavaScript Capitalize

Capitalize is not a built-in JavaScript method — it is composed from two: charAt(0).toUpperCase() uppercases the first letter, then slice(1) appends the rest. A perfect first example of chaining functions.

Syntax

str.charAt(0).toUpperCase() + str.slice(1)

Examples

Input Arguments Output
"hello world" "Hello world"
"éric" "Éric"

When to use it

  • Format names, titles and labels for display.

Gotchas

  • Only capitalises the first character, not every word — chain split(" ") + map to title-case a full sentence.

Try it live

Type your input and see Capitalize transform it instantly.

Description: Capitalizes the first letter of a string.

Example: 'chocolate cake' => 'Chocolate cake'

Want to go further? Chain Capitalize with other functions in the visual Playground — pipe one output into the next and watch your data transform.

Related functions

© 2026 Heifara Buval