Comparisons
>、<、>=、<=、==、!=、===、!==
Boolean is the result
alert( 2 > 1 ); // true (correct)
alert( 2 == 1 ); // false (wrong)
let result = 5 > 4; // assign the result of the comparison
alert( result ); // trueString comparison
Comparison of different types
alert( '2' > 1 ); // true, string '2' becomes a number 2
alert( '01' == 1 ); // true, string '01' becomes a number 1Strict equality
Comparison with null and undefined
Last updated