JavaScript String toUpperCase() Tutorial

In this section, we will learn what the String toUpperCase() method is and how to use it in JavaScript.

JavaScript String toUpperCase() Method

The toUpperCase() method is used to turn the letters of a string value into uppercase.

Note: this method won’t change the original string value but create a new one and return that as a result.

JavaScript String toUpperCase() Syntax

string.toUpperCase()

String toUpperCase() Method Parameters:

The method does not take any argument.

String toUpperCase() Method Return Value:

The return value of this method is the same string value with all letters uppercase.

Example: convert lowercase to uppercase

const id = "If you work hard, then dreams will come true";

const res = id.toUpperCase();

console.log(res);

Output:

IF YOU WORK HARD, THEN DREAMS WILL COME TRUE

Leave a Reply