Strict vs Loose Equality
Multiple Choice Medium
Question
What does `"5" == 5` evaluate to in JavaScript?
Hint
The == operator performs type coercion before comparing.
Explanation
The loose equality operator == performs type coercion. It converts the string "5" to the number 5 before comparing, so "5" == 5 is true. However, "5" === 5 is false because === checks both value and type without coercion. Best practice is to always use ===.
Related Resources
Related Lessons
- Conditions (if/else)
Learn how if/else conditions work.
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.