Documentation

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

Sections

Strict Equality (=== and !==)

Strict equality operators check if values are exactly the same, including their type.

Strict Equal (===)

5 === 5           // true (same type and value)
5 === '5'         // false (number vs string)
'hello' === 'hello'  // true
true === 1        // false (boolean vs number)

Returns true only if both type AND value match.

Not Equal (!==)

5 !== 10          // true (different values)
5 !== '5'         // true (different types)
'cat' !== 'cat'   // false (exactly the same)

Returns true if type OR value are different.

Why Type Matters

const age = 18;
const input = '18';
age === input  // false! (number !== string)

Always use === and !== in JavaScript to avoid surprises.