Comparison and String Operators
In short: > < >= <= compare numbers by size, the way a balance scale
weighs two things against each other. But given two strings, they
compare letter by letter using each character's underlying code —
"apple" < "banana" is true because 'a' sits before 'b', and the
comparison stops at the first letter that differs. This means "9" > "80"
is true — as text, '9' outranks '8' — even though the number 9 is
smaller than 80. The + operator is also overloaded: between numbers it
adds, but with a string on either side it joins text.

Weigh two numbers on the scale
For numbers, comparison operators behave exactly as expected — pure size:
8 > 5 is true — a straightforward size comparison. "apple" < "banana"
is also true, but for a different reason entirely: it compares the first
character of each string, 'a' against 'b', finds they differ, and stops
right there — the rest of each word is never even looked at.
Compare two version numbers as text
This is where string comparison stops matching intuition — it never converts to a number unless you ask it to:
"9" > "80" is true: both sides are strings, so the comparison checks
character by character, and '9' comes after '8' in character order —
the comparison never gets to the second character of "80" at all. Change
one side to a real number, "9" > 80, and the rule flips: with a number on
one side, the string is converted to a number first, giving the expected
false (9 is not greater than 80).
Join two strings with plus
+ adds when both sides are numbers, but the moment either side is a
string, it switches to concatenation — gluing text together:
This prints "Blue Hour". Each + here sees a string on at least one
side, so it joins rather than adds — the same rule that turns 5 + "5"
into "55" in the arithmetic lesson.
Quick practice
What is 8 > 5?
What is "apple" < "banana"?
What is "9" > "80"?
What is "9" > 80?
What does "Blue" + " " + "Hour" produce?
🎯 Your turn
A settings page compares two version numbers with "9" > "80" to decide
which is newer, and gets true. Explain exactly why, and how you would
fix the comparison.
Write your explanation and submit it — there's no code to run here, just your reasoning.
