Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

JavaScript | String.prototype.toLocaleLowerCase() Method

  • Last Updated : 02 Apr, 2020

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:

Hey geek! The constant emerging technologies in the world of web development always keeps the excitement for this subject through the roof. But before you tackle the big projects, we suggest you start by learning the basics. Kickstart your web development journey by learning JS concepts with our JavaScript Course. Now at it's lowest price ever!

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:




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

Output:

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

Example 2:




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

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

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



My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!