javascript check string ignorecase code example
Example 1: how to compare strings in javascript ignoring case sensitive
const str1 = '[email protected]';
const str2 = '[email protected]';
str1 === str2;
str1.toLowerCase() === str2.toLowerCase();
Example 2: compare string camelcase and lowercase javascript
var haystack = "A. BAIL. Of. Hay.";
var needle = "bail.";
var needleRegExp = new RegExp(needle.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), "i");
var result = needleRegExp.test(haystack);
if (result) {
}