1var array = ['I', 'hAve', 'theSe', 'ITEMs'],
2 query = 'these',
3 result = array.findIndex(item => query.toLowerCase() === item.toLowerCase());
4
5console.log(result); // 2
1var name1 = "Taylor Johnson";
2var name2 ="taylor johnson";
3
4//convert to lowercase for case insensitive comparison
5if(name1.toLowerCase() === name2.toLowerCase()){
6 //names are the same
7}
8
9
1stringtodetect.toLowerCase().includes("stringtocompare");
2
3// OR, Alternatively...
4stringtodetect.toLowerCase().includes(variable.toLowerCase());