Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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");
}
Source by thispointer.com #
 
PREVIOUS NEXT
Tagged: #case #insensitive #string #comparison #JavaScript
ADD COMMENT
Topic
Name
4+6 =