Python Type Coercion & Strict Equality (=== vs ==)
JavaScript automatically converts types in certain operations (type coercion). Strict equality (===) compares both value and type without coercion, while loose equality (==) coerces operands before comparison.
"Loose equality (==) is like a forgiving bouncer who lets you in if you look somewhat similar in poor lighting. Strict equality (===) is a biometric fingerprint scanner checking exact identity."
Deep Dive: How It Works
Strict Equality (===): Checks value AND type. 5 === "5" is false.
Loose Equality (==): Converts types before checking. 5 == "5" is true. (Avoid in modern code!).
The 8 Falsy Values in JavaScript: false, 0, -0, 0n, "", null, undefined, NaN. Everything else is truthy.
Syntax Blueprint
a === b ──▶ Strict equality (no coercion) | a !== b ──▶ Strict inequality
Always prefer === and !== over == and != to avoid unexpected type coercion bugs.
Core Rules to Remember



Common Beginner Traps & How to Fix Them
Using == with 0 or empty strings.Why it happens: 0 == "" evaluates to true due to historic type conversion rules.
How to fix: Enforce === everywhere across your JavaScript codebase.
Live Interactive Example
Hit Run Code to see it liveYour Turn: Micro Challenge
No pressure! Edit the starter code below and test your solution with instant feedback.
Perform explicit type conversion
Given const input = "500";
Convert input to a number using Number(input) and add 100.
Print "Converted Total: 600".
Finished reading and practicing?
Mark this lesson as completed to update your course progress.