Comparisons < > <= >=
The operators < > <= >= compare two values and give back true or false.
A comparison looks at two values and answers with a boolean: true or false.
<means less than.>means greater than.<=means less than or equal.>=means greater than or equal.
A comparison usually lives inside an if or an else if. That is why lesson 01.00 shows else if (age >= 18): the program asks whether the age reaches 18 and picks a path.
Compare numbers with numbers and strings with strings. Strings are compared letter by letter, in simple dictionary order, and uppercase letters come before lowercase ones. If you mix types, JavaScript converts the values and the result can surprise you. TypeScript warns you about that mix before running; the warning is gone when Node runs the code.
Watch the order of the symbols: it is >=, never =>, which is the arrow of an arrow function.
Reach for it when: you need to decide around a limit: a minimum age, a maximum number of attempts, a price cap.
Examples
Common mistake
const age: number = 20; const label: string = "18"; console.log(age >= label);
Why: You are comparing a number with a string. JavaScript would convert it silently, but TypeScript rejects it because it is almost always a bug.
How to write it: Convert the string first: age >= Number(label).
