Documentation

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

Sections

Boolean Operators

true && false // false

These only make sense on booleans — they answer “and”, “or”, and “not”.

x and y

true && false    // false — both have to be true
true && true     // true

x or y

true || false    // true — only one has to be true
false || true    // true — order doesn't matter
false || false   // false

not x

!true    // false — flips it
!false   // true

Combining With Comparisons

Comparisons already give back booleans, so they chain straight into these:

5 > 3 && 10 > 8    // true — both comparisons are true
5 > 3 && 10 > 20   // false — the second one isn't