LESSON 6
Operators
Learning objective: Perform calculations and comparisons with operators.
Understand
Operators let you compute and compare values.
Arithmetic operators (+ - * / %) do math; comparison operators (=== !== > <) return booleans. Always prefer === over == because it compares without surprising type conversions.
Analogy: Operators are like the buttons on a calculator: each performs one action on your values.
See It in Action
Math and comparison:
let total = 5 * 3; // 15
let isBig = total > 10; // true
console.log(total, isBig);How it works: The first line multiplies, the second compares and stores a boolean, and both results are logged.
Try It Yourself
- Compute a total with arithmetic operators.
- Compare two numbers with
>. - Compare two values with
===.
Quick Quiz
Why prefer === over ==?
Challenge
Write expressions that use at least three different operators.
Success condition: Your code correctly computes and compares values.
+10 XP
Lesson Complete
You answered correctly and completed the required practice. Your progress has been saved on this device.
Continue to next lesson →