JavaScript | String.prototype.toLocaleLowerCase() Method

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

Syntax:

str.toLocaleLowerCase()
str.toLocaleLowerCase(locale) 
str.toLocaleLowerCase([locale, locale, ...])

Parameters:

  • locale: It is optional parameter and it indicates the locale to be used to convert to lower case according to any locale-specific case mappings.

Returns Value: This method returns a string of lowercase letter.

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



  • RangeError: If the locale argument isn’t a valid language tag.
  • TypeError: If an array element isn’t of type string.

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

Example 1:

filter_none

edit
close

play_arrow

link
brightness_4
code

const gfg = 'GeeKsForGeekS';
console.log('EN-US: ' + gfg.toLocaleLowerCase('en-US'));
console.log('TR: ' + gfg.toLocaleLowerCase('tr'));
  
const gfg1 = new String("String.prototype.toLocaleLowerCase()");
console.log('Result: ' + gfg1.toLocaleLowerCase());

chevron_right


Output:

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

Example 2:

filter_none

edit
close

play_arrow

link
brightness_4
code

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'); 

chevron_right


Output:

"alphabet"
true
false
true

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

  • Google Chrome
  • Firefox
  • IE
  • Opera
  • Safari
  • Edge

full-stack-img

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.