Sometimes, we may want to check if a substring is in a JavaScript string in a case-insensitive manner.

In this article, we’ll check if a JavaScript string has a substring in a case-insensitive manner.

String.prototype.toLowerCase and String.prototype.indexOf

We can convert both the string and the substring we’re checking for the lower case to check if a substring is in a JavaScript string is in a case-insensitive manner.

For instance, we can write:

#javascript

How to Check if a JavaScript String Contains a Substring in a Case Insensitive Manner?
1.25 GEEK