Operators
(Arithmetic, Comparison, Logical)
Definition
Operators are symbols that perform actions with values (like math, comparisons, or logic).
Arithmetic Operators
let cups = 5 + 2; // 7 let price = 10 - 3; // 7 let crates = 4 * 2; // 8 let half = 10 / 2; // 5
Comparison Operators
5 > 2 // true 7 === 7 // true “cat” === “dog” // false
Logical Operators
true && false // false true || false // true !true // false
Mini-Quiz
- What does a comparison operator return: a number or a boolean?
- What does !true become?
Last updated on