Open In App

What is toUpperCase() Method in JavaScript ?

Last Updated : 12 Feb, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

JavaScript String toUpperCase() method converts the entire string to Upper case. This method does not affect any of the special characters, digits, and the alphabets that are already in the upper case. 

Syntax:

str.toUpperCase()

Example: Here, the toUpperCase() method is called on the str string, converting all lowercase letters to uppercase. The resulting string, "HELLO WORLD", is assigned to the variable upperStr.

Javascript




const str = "hello world";
const upperStr = str.toUpperCase();
 
console.log(upperStr); // Output: "HELLO WORLD"


Output

HELLO WORLD

Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads