String toLowerCase()
In JavaScript, String.toLowerCase()
method is used to convert the given string to lower case string.
Syntax
str.toLowerCase()
where
str
is a string.
toLowerCase()
method makes a copy of the given string, converts the uppercase characters to lowercase characters, and returns the resulting string.
The value in the string variable str
is unmodified.
Example
1. In the following program, we convert the value in string txt
to lowercase.
let txt = 'APPLE Banana';
let output = txt.toLowerCase();
console.log(output);
//output //apple banana