How to compare string case insensitive in JavaScript

1 Answer

0 votes
function areEqualCaseInsensitive(str1, str2) {
    return str1.toUpperCase() === str2.toUpperCase();
}
 
console.log(areEqualCaseInsensitive("abc", "ABC") ? "yes" : "no");

 
 
/*
run:
 
yes
 
*/

 



answered May 4, 2024 by avibootz
...