Javascript String toLowerCase()

The toLowerCase() method returns the string converted to lowercase.

Example


toLowerCase() Syntax

The syntax of the toLowerCase() method is:

str.toLowerCase()

Here, str is a string.


toLowerCase() Parameters

The toLowerCase() method does not take in any parameters.


toLowerCase() Return Value

  • Returns a new string representing the calling string converted to lowercase.

Notes:

  • The toLowerCase() method raises TypeError when called on null or undefined.
  • The toLowerCase() method does not change the original string.

Example: Using toLowerCase() method

Output

hello world!
java is to javascript what car is to carpet.

Recommended Reading: JavaScript String toUpperCase()