Documentation

Student-friendly HTML, CSS, and JavaScript reference with examples

Sections

Comparison Operators

Comparison operators compare two values and return true or false.

The Six Operators

a > b    // greater than
a >= b   // greater than or equal to
a < b    // less than
a <= b   // less than or equal to
a === b  // exactly equal (same type and value)
a !== b  // not equal (different type or value)

Examples

15 > 10      // true
8 >= 8       // true (equal counts!)
5 < 12       // true
20 === 20    // true
5 !== 10     // true (they are different)

Storing Results

const temp = 75;
const isWarm = temp > 20;     // true
const isCool = temp <= 15;    // false
const isExact = temp === 75;  // true