JavaScript – Convert String to Lowercase

To convert a string to lowercase in JavaScript, call toLowerCase() method on the string. The expression returns a new string with all the characters of the calling string transformed to lowercase.

Syntax

The syntax to call toLowerCase() function on the string str is

str.toLowerCase()

toLowerCase() returns a new string with the contents of the original string transformed to lowercase.

ADVERTISEMENT

Examples

In the following example, we take a string str, convert this string to lowercase, and display both the original string, and lowercase transformed string in #output.

index.html

Conclusion

In this JavaScript Tutorial, we learned how to transform a given string to lowercase in JavaScript, using toLowerCase() method, with examples.