Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how to compare strings in javascript ignoring case sensitive

const str1 = 'Bill@microsoft.com';
const str2 = 'bill@microsoft.com';

str1 === str2; // false
str1.toLowerCase() === str2.toLowerCase(); // true
Comment

case insensitive string comparison in JavaScript

let dummyString1 = "rock";
let dummyString2 = "Rock";
let pattern = new RegExp('^' + dummyString2 + '$', 'i');

if (pattern.test(dummyString1)) {
  console.log("String Matched");
} else {
  console.log("String Not Matched");
}
Comment

javascript string insensitive compare

const str1 = 'Bill@microsoft.com';
const str2 = 'bill@microsoft.com';

str1 === str2; // false

// will return 0, means these two strings are equal according to `localeCompare()`
str1.localeCompare(str2, undefined, { sensitivity: 'accent' }); 
Comment

PREVIOUS NEXT
Code Example
Javascript :: npx create-react-app current folder 
Javascript :: regular expression javascript password strength 
Javascript :: javascript format price 
Javascript :: toggle checkbox in javascript 
Javascript :: js narrate text 
Javascript :: how to install react router dom 
Javascript :: node fs exists 
Javascript :: javascript detect if element is scrolled 
Javascript :: how to create a random number generator in javascript 
Javascript :: es6 map usin index 
Javascript :: discord js on message 
Javascript :: string to boolean javascript 
Javascript :: how to pass state values as initial data and support state updates for Formik while using useFormik hook 
Javascript :: javascript sort array smallest to largest 
Javascript :: navigation.openDrawer is not a function react native 
Javascript :: js load js file 
Javascript :: html javascript type 
Javascript :: convert data into json format in javascript 
Javascript :: set multiple attributes css javascript 
Javascript :: jquery selector this and class 
Javascript :: delete multiple keys from object javascript 
Javascript :: delete all node_modules folders recursively windows 
Javascript :: check if function javascript 
Javascript :: element ui handle enter key 
Javascript :: how to get enum item name in javascript 
Javascript :: javascript style onclick 
Javascript :: javascript capitalize array 
Javascript :: invisible character javascript 
Javascript :: js getelementbyid 
Javascript :: Disable Initial Sorting in Datatable 
ADD CONTENT
Topic
Content
Source link
Name
3+1 =