Zero and Negative Zero
You'll learn: Why both 0 and -0 are falsy in JavaScript, while all other numbers (including -1) are truthy.
The Falsy Family: Zero's Special Place
In JavaScript's type coercion system, there are exactly seven falsy values — things that become false in a boolean context. Two of them are numbers: 0 and -0. Every other number, whether positive or negative, is truthy.
Why Zero is Falsy
Think of zero as "nothing" or "absence of value." It's the mathematical identity for addition — it contributes nothing. JavaScript treats both 0 and -0 as representing this same "nothingness," so both are falsy:
Boolean(0); // false
Boolean(-0); // false
Why Other Numbers (Including -1) Are Truthy
Any number that isn't zero represents something — a quantity, a count, a measurement. Even negative numbers like -1 represent a real value:
Boolean(-1); // true
Boolean(1); // true
Boolean(0.001); // true
Boolean(-999); // true
In Conditionals
This matters when you use numbers in if statements or other boolean contexts:
if (0) {
// This block never runs
}
if (-1) {
// This block DOES run — -1 is truthy!
}
Key Takeaway: Both 0 and -0 are the only falsy numbers in JavaScript. All other numbers, including negative ones like -1, are truthy because they represent actual values rather than "nothing."