transformation
String.prototype.toLowerCase
Returns a new string with all characters converted to lower case using Unicode default case mapping. For locale-specific behavior use toLocaleLowerCase.
str.toLowerCase() Parameters
| Parameter | Purpose |
|---|---|
| (no arguments) | Method takes no parameters |
| returns | New lower-cased string |
Examples
console.log('HELLO'.toLowerCase()); Prints 'hello'
console.log('Ω'.toLowerCase()); Prints 'ω'
console.log('ABC123'.toLowerCase()); Prints 'abc123'
console.log('İ'.toLowerCase()); Prints 'i̇' (dot above; use toLocaleLowerCase('tr') for Turkish 'i')
Gotcha
Locale-insensitive — Turkish and Azeri callers should use toLocaleLowerCase('tr'). Returns a new string; original is untouched.
Related methods
String.prototype.toUpperCase
Returns a new string with all characters converted to upper case using the Unicode default case mapping. Locale-insensitive — use toLocaleUpperCase for language-specific rules (e.g. Turkish i).
String.prototype.normalize
Returns the Unicode Normalization Form of the string ('NFC', 'NFD', 'NFKC', or 'NFKD'; default 'NFC'). Essential for reliable comparison of characters that can be represented in multiple code point sequences.
String.prototype.localeCompare
Returns a negative number, 0, or a positive number indicating whether the string sorts before, equal to, or after compareString according to the current or supplied locale. Preferred over < and > for user-visible sorting.
String.prototype.replace
Returns a new string with the first match of pattern replaced. Pattern can be a string (only the first occurrence) or a RegExp (all occurrences when the g flag is set).
String.prototype.replaceAll
Returns a new string with every occurrence of pattern replaced. Added in ES2021; if pattern is a RegExp it must have the g flag or replaceAll throws TypeError.