How to convert a JavaScript String to lowercase

How to convert a JavaScript String to lowercase

JavaScript provides an in-built method to achieve the conversion via toLowerCase(). It will convert all the characters of a string to lowercase.

The method does not change the actual value, meaning, the returned string is a new string from the actual input.

const str = "HAPPY NEW YEAR 2021!";
console.log(str.toLowerCase());

OUTPUT

happy new year 2021!

Stop visitors from leaving your site!
Shares

Recommended Articles

Leave a Reply

Pin It on Pinterest

Shares