What is toLowerCase() Method in JavaScript ?
Javascript str.toLowerCase() method converts the entire string to lowercase. This method does not affect any of the special characters, digits, and the alphabet that is already in lowercase.
Syntax:
str.toLowerCase();
Example: Here, the toLowerCase()
method is called on the str
string, converting all uppercase letters to lowercase. The resulting string, "hello world"
, is assigned to the variable lowerStr
.
Javascript
const str = "HELLO WORLD" ; const lowerStr = str.toLowerCase(); console.log(lowerStr); // Output: "hello world" |
Output
hello world
Contact Us