Languages
[Edit]
EN

JavaScript - convert string to uppercase

5 points
Created by:
Root-ssh
151280

In this article, we would like to show you how to convert string to upper case in JavaScript.

The string class contains two methods that help to make the conversion to upper case. One of them allows making conversion by taking into account locale. To see practical usage of methods look at the below examples.

1. Built-in conversion approach example

This section shows how to convert any string to upper case taking into account locale. In almost all cases it produces a similar output string to the version without locale.

// ONLINE-RUNNER:browser;

var text = 'Hi! How are you?';
var convertedText = text.toUpperCase();

console.log(convertedText);

Output:

HI! HOW ARE YOU?

2. Built-in conversion approach with locale example

This section shows how to convert any string to upper case taking into account locale. In almost all cases it produces a similar output string to the version without locale.

// ONLINE-RUNNER:browser;

var text = 'Здравствуй! Как поживаете?';

var convertedText = text.toLocaleUpperCase();
//var convertedText = text.toLocaleUpperCase('ru-RU');
//var convertedText = text.toLocaleUpperCase(['ru-RU', 'en-US']);

console.log(convertedText);

Output:

ЗДРАВСТВУЙ! КАК ПОЖИВАЕТЕ?

 

Alternative titles

  1. JavaScript - how to convert string to upper case?
  2. JavaScript - how to change string to big letters?
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

Cross technology - convert string to uppercase

Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join