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 raisesTypeErrorwhen called onnullorundefined. - 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()