Strings: Transforming Strings

Join the AI Workshop to learn more about AI and how it can be applied to web development. Next cohort February 1st, 2026

The AI-first Web Development BOOTCAMP cohort starts February 24th, 2026. 10 weeks of intensive training and hands-on projects.


JavaScript provides methods to transform the case and normalize strings.

toUpperCase()

Returns a new string with all characters converted to uppercase:

'Testing'.toUpperCase() //'TESTING'

Does not mutate the original string. Returns an empty string if called on an empty string.

toLowerCase()

Returns a new string with all characters converted to lowercase:

'Testing'.toLowerCase() //'testing'

toLocaleUpperCase()

Returns a new string with the uppercase transformation according to locale case mappings:

'Testing'.toLocaleUpperCase() //'TESTING'
'Testing'.toLocaleUpperCase('it') //'TESTING'
'Testing'.toLocaleUpperCase('tr') //'TESTİNG'

The first parameter represents the locale (optional, defaults to current locale). Different locales may have different case mapping rules—for example, Turkish has special handling for the letter ‘i’.

toLocaleLowerCase()

Returns a new string with the lowercase transformation according to locale case mappings:

'Testing'.toLocaleLowerCase() //'testing'
'Testing'.toLocaleLowerCase('it') //'testing'
'Testing'.toLocaleLowerCase('tr') //'testing'

Use the locale versions when working with international text where case mappings may differ.

normalize()

Returns the string normalized according to a Unicode normalization form.

Unicode has four main normalization forms: NFC, NFD, NFKC, NFKD. The default is NFC if no parameter is provided.

'\u1E9B\u0323'.normalize() //ẛ̣
'\u1E9B\u0323'.normalize('NFD') //ẛ̣
'\u1E9B\u0323'.normalize('NFKD') //ṩ
'\u1E9B\u0323'.normalize('NFKC') //ṩ

Normalization is important when comparing strings that may contain the same characters represented differently in Unicode.

Lessons in this unit:

0: Introduction
1: String Basics
2: Accessing Characters
3: Searching Strings
4: Extracting Substrings
5: ▶︎ Transforming Strings
6: Modifying Strings
7: Trimming and Padding
8: String Recipes
9: Unicode and UTF-8
10: Printable ASCII characters list
11: Non-printable ASCII characters list