Javascript String toLocaleLowerCase() is an inbuilt function that converts a string to lowercase letters, according to the host’s current locale. The toLocaleLowerCase() method returns a calling string value converted to the lower case, according to any locale-specific case mappings.
Javascript toLocaleLowerCase
The locale is based on the language settings of the browser. The toLocaleLowerCase() method returns the same result as the toLowerCase() method. However, for some locales, where language conflict with the regular Unicode case mappings occurs (such as Turkish), the results may vary. Javascript toLocaleLowerCase() method does not change the original string.
Syntax
The syntax of string toLowerCase() function is following.
string.toLocaleLowerCase(locale)
The locale parameter indicates a locale to be used to convert to the lower case according to any locale-specific case mappings. If the multiple locales are given in the Array, the best available locale is used.
The toLocaleLowerCase function returns the String, representing the value of a string converted to lowercase according to the host’s current locale.
See the following example.
// app.js let dottedData = 'Türkçe'; console.log('EN-US: ' + dottedData.toLocaleLowerCase('en-US')); console.log('TR: ' + dottedData.toLocaleLowerCase('tr'));
See the following output.
See other examples.
console.log('KRUNAL'.toLocaleLowerCase()); console.log('\u0130'.toLocaleLowerCase('tr') === 'i'); console.log('\u0130'.toLocaleLowerCase('en-US') === 'i'); let locales = ['tr', 'TR', 'tr-TR', 'tr-u-co-search', 'tr-x-turkish']; console.log('\u0130'.toLocaleLowerCase(locales) === 'i');
See the following output.
That’s it for this tutorial.