Lesson 3 of 4 · 9 minutes
Comparing values
Conditions often compare values. Comparison operators ask
questions: === means equal, > greater than,
< less than, and >= or <=
include equality.
Every comparison gives a boolean: true or false.
Be careful: a single = puts a value in a box. ===
checks whether two values are equal. Use === in a condition.
Comparison asks a question. Assignment fills a box.
Predict first: will each line print true or false?
Loading the editor…
Quick check
You can now build conditions by comparing values — and you know why = and === must not be swapped.