Open In App

JavaScript String toLocaleLowerCase() Method

The String.prototype.toLocaleLowerCase() method in JavaScript is a Standard built-in object which returns the calling string value converted to a lowercase letter on the basis of the host’s current locale. 

Syntax:

str.toLocaleLowerCase()
str.toLocaleLowerCase(locale)

Parameters:

Returns Value:

This method returns a string of lowercase letters. 



Exceptions:

This method gives two kinds of errors, which are as follows:

The below examples illustrate the String.prototype.toLocaleLowerCase() method in JavaScript: 



Example 1: In this example, we will convert the uppercase string to a lowercase string and console it using the String.prototype.toLocaleLowerCase() method in JavaScript.




// Input string
let gfg = 'GeeKsForGeekS';
 
// Output with lowercase method
console.log('EN-US: ' + gfg.toLocaleLowerCase('en-US'));
console.log('TR: ' + gfg.toLocaleLowerCase('tr'));
 
// New input string
let gfg1 = new String("String.prototype.toLocaleLowerCase()");
 
// Display output
console.log('Result: ' + gfg1.toLocaleLowerCase());

Output
EN-US: geeksforgeeks
TR: geeksforgeeks
Result: string.prototype.tolocalelowercase()

Example 2: In this example, we will convert the uppercase string to a lowercase string and console it using the String.prototype.toLocaleLowerCase() method in JavaScript.




console.log('ALPHABET'.toLocaleLowerCase());
     
console.log('\u0130'.toLocaleLowerCase('tr') === 'i');
console.log('\u0130'.toLocaleLowerCase('en-US') === 'i');
     
let geeks = ['tr', 'TR', 'tr-TR', 'tr-u-co-search', 'tr-x-turkish'];
console.log('\u0130'.toLocaleLowerCase(geeks) === 'i');

Output
alphabet
true
false
true

We have a complete list of Javascript String methods, to check those please go through this JavaScript String Complete Reference article.

Supported Browsers: The browsers supported by the String.prototype.toLocaleLowerCase() method are listed below:


Article Tags :