Falsy Values Check
Multiple Choice Medium
Question
Which of the following is NOT a falsy value in JavaScript?
Hint
Empty arrays and objects are truthy!
Explanation
The falsy values in JavaScript are: false, 0, -0, 0n, "", null, undefined, and NaN. An empty array [] and empty object {} are truthy! This is a common gotcha when checking if a collection is empty. Use arr.length === 0 instead of if (!arr).
Related Resources
Related Lessons
- Data Types
Learn about primitive data types.
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.