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!