What Are Truthy and Falsy Values?
Understand truthy and falsy values in JavaScript and learn how JavaScript evaluates conditions.
What Are Truthy and Falsy Values?
JavaScript automatically converts values into either true or false when evaluating conditions.
These values are known as:
- Truthy Values
- Falsy Values
Falsy Values
JavaScript has a small set of values that evaluate to false:
- false
- 0
- -0
- ""
- null
- undefined
- NaN
Example:
if (0) { console.log("Hello"); }
The code inside the block will not execute.
Truthy Values
Almost every other value is truthy.
Examples:
- "Hello"
- []
- {}
- 42
- "false"
Example:
if ("Hello") { console.log("Runs"); }
The condition evaluates to true.
Why Are Truthy and Falsy Values Important?
They are commonly used in:
- Conditional Statements
- Form Validation
- Default Values
- Short-Circuit Evaluation
Understanding them helps avoid bugs.
Common Interview Topic
Truthy and falsy values are frequently discussed during JavaScript interviews because they reveal how well a candidate understands type coercion.
The Bottom Line
Falsy values evaluate to false in conditions, while most other values are truthy. Understanding this behavior is essential for writing reliable JavaScript code.
JavaScript has a small set of falsy values including false, 0, '', null, undefined, and NaN.
Yes. Empty arrays are truthy in JavaScript.
Yes. Empty objects are truthy.
No. Any non-empty string is truthy.
They are widely used in conditional logic and interview questions.
Ready to master Javascript completely?
Want to upskill yourself, crack your next interview, and get your dream job? Join our comprehensive course to dive deeper with high-quality video tutorials, solve interview questions, and a premium community.
Master Javascript
Want to upskill yourself, crack your next interview, and get your dream job? Join our comprehensive course.

