Latest Code Tutorials

Javascript String ToLocaleUpperCase() Example


Javascript string toLocaleUpperCase() is an inbuilt function that is used to convert the string into the uppercase based on locale. The toLocaleUpperCase() method is the method of a String object, it must be invoked through the particular instance of the String class. We have already covered a Javascript toLocaleLowerCase().

Javascript String toLocaleUpperCase()

In JavaScript, the syntax for the toLocaleUpperCase() method is following.


The locale parameter is optional and indicates a locale to be used to convert to the upper case according to any locale-specific case mappings if the multiple locales are given in an Array.

See the following code example.

// app.js

let data = 'brōkən';

See the following output.

Javascript String ToLocaleUpperCase() Tutorial

The toLocaleUpperCase() method returns a value of the string converted to the upper case according to any locale-specific case mappings.

The toLocaleUpperCase() does not affect the value of a string itself. In most cases, it will produce the same outcome as toUpperCase(), but for some locales, such as the Turkish, whose case mappings do not follow a default case mappings in the Unicode, there may be a different outcome.

Also notice that conversion is not necessarily the 1:1 character mapping, as some of the characters might result in the two or even more characters when transformed to the upper-case.

Therefore the length of the result string can differ from an input length. This also implies that the conversion is not stable, for example, the following code can return the false:

x.toLocaleLowerCase() === x.toLocaleUpperCase().toLocaleLowerCase()

See the following more examples.

// app.js




let locales = ['lt', 'LT', 'lt-LT', 'lt-u-co-phonebk', 'lt-x-lietuva'];

See the following output.

String ToLocaleUpperCase() Tutorial With Example

Finally, Javascript String ToLocaleUpperCase() Tutorial With Example is over.

Leave A Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.