Variables comparison in JavaScript
In the examples above, we compared a variable and some number. But no one forbids us to compare two variables. See an example:
javascriptlet test1 = 1;
let test2 = 2;
if (test2 > test1) {
console.log('+++'); // it will work
} else {
console.log('---');
}
Задание 1
The variables test1 and test2
are given. Check value of which variable is
greater and display the corresponding message.
Задание 2
The variables test1 and test2
are given. Check if their values are equal
and display the corresponding message.