When working on a website and using Javascript, there may be so many instances where you would want to change the casing of a string to lower case.
A common example is when comparing two strings in javascript.
As we know that in Javascript, strings are case sensitive, It's a good practice to match the casing of strings when comparing strings.
This is just one use case when we need to change the casing of a string to lower case.
Javascript provides the toLowerCase method to us for this use.
Understanding the toLowerCase Method
The toLowerCase method in Javascript converts a string to all lowercase characters.
Let's look at some code to see how we use the toLowerCase method.
const nameInMixedCasing = "CodE LiKE a deV";
const nameInLowerCase = nameInMixedCasing.toLowerCase();
// Result: "code like a dev"