How to Convert a String to Lowercase in JavaScript ?

To convert a string to lowercase in JavaScript, you can use the toLowerCase() method. This method does exactly what it sounds like – it transforms all the characters in a string to lowercase.

Example: Here, toLowerCase() is applied to the myString variable, and the result is stored in the lowercaseString variable. After this operation, lowercaseString will contain the string “hello, world!”.

Javascript




let myString = "Hello, World!";
let lowercaseString = myString.toLowerCase();
 
console.log(lowercaseString);


Output

hello, world!