JavaScript Comparison Operators
Comparison operators ask questions about values.
The answer is always true or false.
Think of a referee checking who is taller or who scored more.
Bigger and smaller
Equal and not equal
Strict equals
Why strict checks matter
Greater and less
> means greater than. < means less than.
>= and <= also allow equal values.
Loose equals
== asks if values look the same after JavaScript tries to match types.
That can surprise you.
Strict equals
=== asks if value and type both match.
No quiet conversion happens.
Not equal
!= is loose not equal. !== is strict not equal.
Use comparisons in choices
Comparisons shine inside if statements.
They help your program pick a path.
Tip: Use === and !== most of the time. They tell the truth without sneaky type changes.
Test yourself
Three quick questions made just for this lesson. Earn 10 XP per correct answer.