String equality in JavaScript
When using the if construct, strings
can also be compared. For example, let the
variable test store some string, for
example 'abc':
let test = 'abc';
Let's check if the content of the variable
test is equal to the string 'abc':
let test = 'abc';
if (test == 'abc') {
console.log('+++'); // it will work
} else {
console.log('---');
}
Given the variables test1 and
test2 containing strings. Check
if their values are equal and display
the corresponding message.