Answers for "javascript includes case insensitive"

1

array contains case insensitive javascript

var array = ['I', 'hAve', 'theSe', 'ITEMs'],
    query = 'these',
    result = array.findIndex(item => query.toLowerCase() === item.toLowerCase());

console.log(result); // 2
Posted by: Guest on April-01-2020
3

Javascript case insensitive string comparison

var name1 = "Taylor Johnson";
var name2 ="taylor johnson";

//convert to lowercase for case insensitive comparison
if(name1.toLowerCase() === name2.toLowerCase()){
    //names are the same
}
Posted by: Guest on July-25-2019
0

javascript includes case insensitive

stringtodetect.toLowerCase().includes("stringtocompare");

// OR, Alternatively...
stringtodetect.toLowerCase().includes(variable.toLowerCase());
Posted by: Guest on September-27-2021
-2

js includes case insensitive

var passedinstring = localStorage.getItem("passedinstring").toLowerCase();
Posted by: Guest on November-25-2020

Code answers related to "javascript includes case insensitive"

Code answers related to "Javascript"

Browse Popular Code Answers by Language