how to compare string in javascript in function code example
Example 1: compare strings js
const s1 = 'learn';
const s2 = 'today';
console.log(s1 === 'learn'); // true
console.log(s1 === s2); // false
Example 2: string comparison in javascript
var str1 = "ab";
var str2 = "ab";
var n = str1.localeCompare(str2);