How to Use the String toUpperCase() Method in Javascript
The String.toUpperCase() method converts a string to all uppercase letters in JavaScript. It doesn't change anything else about the original string and doesn't take any parameters.
We'll give you a quick rundown on how to use it!
Here's a code example:
Javascript
 
const yourString = "Dogs are better than cats."
 
console.log(yourString.toUpperCase())
// output: "DOGS ARE BETTER THAN CATS."
As you can see, the toUpperCase() method returns the value of the string but in all uppercase.
Here's another example, but with an original string that has a wide mix of lowercase and uppercase letters in it:
Javascript
 
const yourString = "DoGs aRe BEttER than CATS."
 
console.log(yourString.toUpperCase())
// output: "DOGS ARE BETTER THAN CATS."
And you should see that it works the same as before!
Thanks for reading!