JavaScript(JS) string method - touppercase

www.i‮‬giftidea.com

The toUpperCase() method is a string method in JavaScript that is used to convert a string to uppercase letters.

Here is the syntax for the toUpperCase() method:

str.toUpperCase()

Here, str is the string you want to convert to uppercase.

The toUpperCase() method returns the str with all letters converted to uppercase.

Here is an example of using the toUpperCase() method:

let str = "HeLLo WorLD";
let result = str.toUpperCase();
console.log(result); // "HELLO WORLD"

In the example above, the toUpperCase() method converts all lowercase letters in the str to uppercase, resulting in the string "HELLO WORLD".

Note that the toUpperCase() method does not modify the original str. Instead, it returns a new string with all letters converted to uppercase.