A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.geeksforgeeks.org/javascript-string-tolocaleuppercase-method/ below:

JavaScript String toLocaleUpperCase() Method - GeeksforGeeks

JavaScript String toLocaleUpperCase() Method

Last Updated : 12 Jul, 2025

The String.prototype.toLocaleUpperCase() method in JavaScript is a Standard built-in object which returns the calling string value converted to the uppercase letter on the basis of the host's current locale. This method mostly returns a similar result as the string toUppercase() method

Syntax:
str.toLocaleUpperCase()
str.toLocaleUpperCase(locale)
Parameters: Returns Value:

This method returns a string of uppercase letters. 

Exceptions:

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

Example 1: In this example, we will convert some lowercase strings into uppercase letters using the String.prototype.toLocaleUpperCase() method in JavaScript.

javascript
// Input string
let gfg = 'GeeKsForGeekS';

// Display output with upper case
console.log('EN-US: ' + gfg.toLocaleUpperCase('en-US'));
console.log('TR: ' + gfg.toLocaleUpperCase('tr'));

// New input string
let gfg1 = new String("String.prototype.toLocaleUpperCase()");

// Display output with upper case
console.log('Result: ' + gfg1.toLocaleUpperCase());

Output
EN-US: GEEKSFORGEEKS
TR: GEEKSFORGEEKS
Result: STRING.PROTOTYPE.TOLOCALEUPPERCASE()

Example 2: In this example, we will convert some lowercase strings into uppercase letters using the String.prototype.toLocaleUpperCase() method in JavaScript.

javascript
console.log('ALPHABET'.toLocaleUpperCase());

console.log('i\u0307'.toLocaleUpperCase('tr') === 'I');
console.log('i\u0307'.toLocaleUpperCase('lt-LT') === 'I');

let geeks = ['lt', 'LT', 'lt-LT', 'lt-u-co-phonebk', 'lt-x-lietuva'];
console.log('i\u0307'.toLocaleUpperCase(geeks) === 'I'); 

Output
ALPHABET
false
true
true
Supported Browsers:

The browsers supported by the String.prototype.toLocaleUpperCase() method are listed below:



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4