how to compare two strings in javascript if condition code example
Example 1: compare if strings are equal javascript
new String("a").valueOf() == new String("a").valueOf()
Example 2: javascript compare strings
console.log(NaN===NaN);
Example 3: how to compare two strings in javascript if condition
var string1 = "Hello World";
var string2 = "Hello world.";
if (string1 === string2) {
console.log("Matching strings!");
}
else {
console.log("Strings do not match");
}
Example 4: compare if strings are equal javascript
new String("a") == new String("a")