In this article, we'll give you a quick rundown on how to use it!
Here's a code example:
const yourString = "Dogs are better than cats." 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:
const yourString = "DoGs aRe BEttER than CATS." yourString.toUpperCase() // output: "DOGS ARE BETTER THAN CATS."
You should see that it works the same as before, regardless of how many lowercase letters are in the string or where they are located.
This method is supported in all browsers and even works all the way back to IE6.
Thanks for reading!