To do case insensitive search, you can use regular expressions and the String#match() function , or you can convert both the string and substring to lower case using the String#toLowerCase() function.
How do I make JavaScript not case sensitive?
The most basic way to do case insensitive string comparison in JavaScript is using either the toLowerCase() or toUpperCase() method to make sure both strings are either all lowercase or all uppercase .