...

/

Comparison Operators: <, >, <=, >=, ==, ===, !=, !==

Comparison Operators: <, >, <=, >=, ==, ===, !=, !==

Learn even more operators. We'll go over less than, greater than, equal to, and all of their variations. We'll go into how the double and triple-equal signs differ and which one we should use.

We'll cover the following...

We have more operators to cover, but I promise this is it!

< | >

These two operators are used to compare the value of numbers. They result in true or false and are often used in if-statements. > means greater than and < means less than.

Press + to interact
if(10 > 5) {
console.log('Condition is true!');
} else {
console.log('Condition is false.');
}
Press + to interact
if(10 < 5) {
console.log('Condition is true!');
} else {
console.log('Condition is false.');
}

<= | >=

These mean “less than or equal to” and “greater than or equal to” respectively.

Press + to interact
if(10 >= 5) {
console.log('Condition is true!');
} else {
console.log('Condition is false.');
}
if(5 >= 5) {
console.log('Condition is true!');
} else {
console.log('Condition is false.');
}
Press + to interact
if(5 <= 10) {
console.log('Condition is true!');
} else {
console.log('Condition is false.');
}
if(5 <= 5) {
console.log('Condition is true!');
} else {
console.log('Condition is false.');
}
...