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
}
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
}
how to compare strings in javascript ignoring case sensitive
const str1 = '[email protected]';
const str2 = '[email protected]';
str1 === str2; // false
str1.toLowerCase() === str2.toLowerCase(); // true
javascript string insensitive compare
const str1 = '[email protected]';
const str2 = '[email protected]';
str1 === str2; // false
// will return 0, means these two strings are equal according to `localeCompare()`
str1.localeCompare(str2, undefined, { sensitivity: 'accent' });
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us