Tell me 3 different ways to make case insensitive string comparison in js, thanks.
Share
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
example 1
2. Using localeCompare() method:
The localeCompare() method compares two strings in the current locale, and it can be made case-insensitive by passing the appropriate options.
and
3. Using a regular expression:
Convert both strings to lowercase using a regular expression and then compare them.