JavaScript String toUpperCase() Method

The method toUpperCase in JavaScript is utilized to transform a string into uppercase. It does not modify the original string in any way.

Syntax

The syntax for invoking the toUpperCase method is as follows:

Example

string.toUpperCase()

Return

String in uppercase letter.

JavaScript String toUpperCase Method Example

Let's explore a few basic illustrations showcasing the implementation of the toUpperCase function.

Example 1

In this section, we will demonstrate how to display a string in uppercase characters.

Example

<script>

var str = "Example";

document.writeln(str.toUpperCase());

</script>

Output:

Output

Example

Example 2

Here is another illustration demonstrating how to display a string in capital letters.

Example

<script>

var str = "C# Tutorial TUTORIALS";

document.writeln(str.toUpperCase());

</script>

Output:

Output

C# Tutorial TUTORIALS

Input Required

This code uses input(). Please provide values below: