PASSWORD RESET

Your destination for complete Tech news

How to convert string to lowercase in Javascript?

282 0
< 1 min read

To convert a string to lowercase in JavaScript, you can use the toLowerCase method of the String object.

Here’s an example of how you can use the toLowerCase method to convert a string to lowercase:

let str = 'HELLO WORLD';
let lowercase = str.toLowerCase();
console.log(lowercase); // Outputs "hello world"

The toLowerCase method does not modify the original string, but instead returns a new lowercase string.

You can also use the toLowerCase method with a string literal:

let lowercase = 'HELLO WORLD'.toLowerCase();
console.log(lowercase); // Outputs "hello world"

Leave A Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.