Skip to content

JavaScript toLocaleUpperCase() | String method

  • by

JavaScript toLocaleUpperCase() string method is used to convert the string to an uppercase letter on the basis of the host’s current locale. The locale is based on the language settings of the browser.

string.toLocaleUpperCase()

This method does not change the original string and returns the same result as toUpperCase() method.

JavaScript toLocaleUpperCase()

Simple example code.

<!DOCTYPE html>
<html>
<body>
  <script>
    const city = 'istanbul';

    console.log(city.toLocaleUpperCase('en-US'));
    console.log(city.toLocaleUpperCase('TR'));

  </script>
</body>
</html>

Output:

JavaScript toLocaleUpperCase String method

More examples

'alphabet'.toLocaleUpperCase(); // 'ALPHABET'

'Gesäß'.toLocaleUpperCase(); // 'GESÄSS'

'i\u0307'.toLocaleUpperCase('lt-LT'); // 'I'

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

Do comment if you have any doubts or suggestions on this Js string method tutorial.

Note: The All JS Examples codes are tested on the Firefox browser and the Chrome browser.

OS: Windows 10

Code: HTML 5 Version

Leave a Reply

Your email address will not be published. Required fields are marked *