How do you use the string toLowerCase() method in JavaScript to transform a given string into all lowercase letters?

The toLowerCase() method converts a string to all lowercase letters in JavaScript. It doesn't change anything else about the original string, doesn't take any parameters, and is applied to all the letters in a given 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.

We also have an article on how to use the toUpperCase() method.

Thanks for reading and happy coding!