How to get the lowercase equivalent of a string in Javascript?

javascript

(afree) #1

Hi,

I want to compare two strings, but with ignoring the case of both strings, so I need to get the lowercase of both strings then compare them! I am using Javascript!

How can I get the lowercase equivalent of a string?

thanks


(SAM) #2

The string Javascript class has a toLowerCase() method you can use to get the lowercase equivalent of your string.

Examples:

myString.toLowerCase();
// These are similar...
"My String".toLowerCase();