How do you use the string
In this article, we'll give you a quick rundown on how to use it!
Here's a code example of the method in practice:
const yourString = "Dogs are better than cats." yourString.toLowerCase() // output: "dogs are better than cats."
As you can see in the code above, the
toLowerCase() method returns the value of the string but as a new version with all lowercase letters.
Here's another example, but with an original string that has all capital letters:
const yourString = "DOGS ARE BETTER THAN CATS." yourString.toLowerCase() // output: "dogs are better than cats."
You should see that it works the same as before, regardless of how many uppercase 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 and happy coding!