How to perform case-insensitive two strings comparison in Node.js

1 Answer

0 votes
function equalsIgnoreCase(str1, str2) {
    return str1.toLowerCase() === str2.toLowerCase();
}

const str1 = "profession: node.js Programmer";
const str2 = "Profession: NODE.JS PROGRAMMER";

const equals = equalsIgnoreCase(str1, str2);

console.log(equals);



   
/*
run:
   
true
  
*/

 



answered Feb 24, 2025 by avibootz

Related questions

1 answer 93 views
1 answer 100 views
1 answer 89 views
1 answer 106 views
1 answer 88 views
...