JavaScript String toLocaleUpperCase() Method
You are Here:
JavaScript String toLocaleUpperCase() Method
The toLocaleUpperCase()
method returns the calling string value converted to upper case, according to any locale-specific case mappings.
Note: This method does not alter the original string.
Example
HTML Online Editor
<!DOCTYPE html>
<html>
<body>
<script>
var str = "i̇a Gesäß";
// 'lt-LT' = Lithuania
var locale = 'lt-LT';
var result = str.toLocaleUpperCase(locale);
document.write(result);
</script>
</body>
</html>
Syntax
str.toLocaleUpperCase(locale)
Parameter Values
Value | Type | Explanation |
---|---|---|
locale | optional | The locale parameter indicates the locale to be used to convert to upper case according to any locale-specific case mappings. If omitted, the default locale is the host environment’s current locale. |
Return Value
Value | Explanation |
---|---|
String | Returns a new string representing the calling string converted to upper case, according to any locale-specific case mappings. |
toLocaleUpperCase() vs toUpperCase()
In the following example, we will check whether toLocaleUpperCase() and toUpperCase() string methods return the same result.
HTML Online Editor
<!DOCTYPE html>
<html>
<body>
<script>
var str = "i̇a Gesäß";
// 'lt-LT' = Lithuania
var locale = 'lt-LT';
var result1 = str.toLocaleUpperCase(locale);
var result2 = str.toUpperCase();
document.write(result1 == result2);
</script>
</body>
</html>
Reminder
Hi Developers, we almost covered 97% of JavaScript Tutorials with examples for quick and easy learning.
We are working to cover every Single Concept in JavaScript.
Please do google search for:
Join Our Channel
Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.
This channel is primarily useful for Full Stack Web Developer.