हमें एक JavaScript फ़ंक्शन लिखना है जो दो स्ट्रिंग को तर्क के रूप में लेता है। फ़ंक्शन को उनके केस को नज़रअंदाज करते हुए दोनों स्ट्रिंग की समानता की जांच करनी चाहिए।
उदाहरण के लिए -
areEqual('done', 'DOne') को true लौटाना चाहिए।
उदाहरण
इसके लिए कोड होगा -
const str1 = 'done';
const str2 = 'DOne';
const caseSensitiveCheck = (str1 = '', str2 = '') => {
const loweCase1 = str1.toLowerCase();
const loweCase2 = str2.toLowerCase();
return loweCase1 === loweCase2;
};
console.log(caseSensitiveCheck(str1, str2));
आउटपुट
कंसोल में आउटपुट होगा -
true