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"
