JavaScript String toLocaleLowerCase() method is used to convert a string to lowercase letters, using the current locale. The locale is based on the language settings of the browser. This method does not modify the original string.
Syntax
string.toLocaleLowerCase(locale)
Parameters
locale(optional): It is the parameter that indicates locale to convert to the lowercase according to any locale-specific case mappings. If multiple locales are given in the Array, the best available locale is used.
Return value
Returns the string representing the value of a string converted to lowercase according to the host’s current locale.
Visual RepresentationExample 1: How to Use the toLocaleLowerCase() Method
let text = 'AppDividend';
console.log(text.toLocaleLowerCase());
Output
appdividend
Example 2: Using different locales
let text = 'AppDividend';
console.log('EN-US: ' + text.toLocaleLowerCase('en-US'));
console.log('TR: ' + text.toLocaleLowerCase('tr'));
console.log('De: ' + text.toLocaleLowerCase('de-DE'));
Output
EN-US: appdividend
TR: appdividend
De: appdividend
In the above example, we applied the toLocaleLowerCase() method to the string ‘AppDividend‘ using various locale settings: U.S. English (en-US), Turkish (tr), and German (de-DE). The output is ‘appdividend‘ for all specified locales because ‘AppDividend‘ does not contain any locale-specific characters that the locale parameter in the method would affect.
Browser compatibility
- Google Chrome 1
- Edge 12
- Firefox 1
- Opera 4
- Safari 1.3
Related posts
JavaScript toLocaleUpperCase()
Krunal Lathiya is a seasoned Computer Science expert with over eight years in the tech industry. He boasts deep knowledge in Data Science and Machine Learning. Versed in Python, JavaScript, PHP, R, and Golang. Skilled in frameworks like Angular and React and platforms such as Node.js. His expertise spans both front-end and back-end development. His proficiency in the Python language stands as a testament to his versatility and commitment to the craft.