String.prototype.toLocaleLowerCase()
The toLocaleLowerCase()
method returns the calling string
value converted to lower case, according to any locale-specific case mappings.
Syntax
toLocaleLowerCase()
toLocaleLowerCase(locale)
toLocaleLowerCase([locale1, locale2, ...])
Parameters
locale
Optional-
The
locale
parameter indicates the locale to be used to convert to lower case according to any locale-specific case mappings. If multiple locales are given in anArray
, the best available locale is used. The default locale is the host environment's current locale.
Return value
A new string representing the calling string converted to lower case, according to any locale-specific case mappings.
Exceptions
-
A
RangeError
("invalid language tag: xx_yy") is thrown if alocale
argument isn't a valid language tag. -
A
TypeError
("invalid element in locales argument") is thrown if an array element isn't of type string.
Description
The toLocaleLowerCase()
method returns the value of the string converted
to lower case according to any locale-specific case mappings.
toLocaleLowerCase()
does not affect the value of the string itself. In most
cases, this will produce the same result as toLowerCase()
, but for some locales, such as Turkish, whose case mappings do not
follow the default case mappings in Unicode, there may be a different result.
Examples
Using toLocaleLowerCase()
'ALPHABET'.toLocaleLowerCase(); // 'alphabet'
'\u0130'.toLocaleLowerCase('tr') === 'i'; // true
'\u0130'.toLocaleLowerCase('en-US') === 'i'; // false
let locales = ['tr', 'TR', 'tr-TR', 'tr-u-co-search', 'tr-x-turkish'];
'\u0130'.toLocaleLowerCase(locales) === 'i'; // true
Specifications
Specification |
---|
ECMAScript Language Specification # sec-string.prototype.tolocalelowercase |
ECMAScript Internationalization API Specification # sup-string.prototype.tolocalelowercase |
Browser compatibility
Report problems with this compatibility data on GitHubdesktop | mobile | server | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
toLocaleLowerCase | ChromeFull support1 | EdgeFull support12 | FirefoxFull support1 | Internet ExplorerFull support5.5 | OperaFull support4 | SafariFull support1.3 | WebView AndroidFull support1 | Chrome AndroidFull support18 | Firefox for AndroidFull support4 | Opera AndroidFull support10.1 | Safari on iOSFull support1 | Samsung InternetFull support1.0 | DenoFull support1.0 | Node.jsFull support0.10.0 |
locale | ChromeFull support58 | EdgeFull support12 | FirefoxFull support55 | Internet ExplorerFull support6 | OperaFull support45 | SafariFull support10 | WebView AndroidFull support58 | Chrome AndroidFull support58 | Firefox for AndroidFull support55 | Opera AndroidFull support43 | Safari on iOSFull support10 | Samsung InternetFull support7.0 | DenoFull support1.8 | Node.jsFull support13.0.0 |
Legend
- Full support
- Full support
- Partial support
- Partial support
- See implementation notes.