To convert a string to lowercase in JavaScript, you can use the toLowerCase()
method of the String object.
In this example,
str
with the value "Hello World"
.toLowerCase()
on str
and store the result in a new variable lowercaseStr
.lowercaseStr
to the console.// Convert "Hello World" to Lowercase
let str = "Hello World";
let lowercaseStr = str.toLowerCase();
console.log(lowercaseStr);
hello world
In this example,
str
with the value "JavaScript Programming"
.toLowerCase()
on str
and store the result in a new variable lowercaseStr
.lowercaseStr
to the console.// Convert "JavaScript Programming" to Lowercase
let str = "JavaScript Programming";
let lowercaseStr = str.toLowerCase();
console.log(lowercaseStr);
javascript programming
In this tutorial, we learned How to convert String to Lowercase in JavaScript language with well detailed examples.