⊗jsPmCdVC 108 of 502 menu

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:

let test1 = 1; let test2 = 2; if (test2 > test1) { console.log('+++'); // it will work } else { console.log('---'); }

The variables test1 and test2 are given. Check value of which variable is greater and display the corresponding message.

The variables test1 and test2 are given. Check if their values are equal and display the corresponding message.

enru