What are falsy values in JavaScript?
The falsy values in JavaScript are 0, 0n, null, undefined, false, NaN, and the empty string "". They evaluate to false when coerced by JavaScript’s typing engine into a boolean value, but they are not necessarily equal to each other.
Falsy values in JavaScript
“A falsy value is a value that is considered false when encountered in a Boolean context.” — Mozilla Developer Network
In JavaScript, there is a special list of following 7 values, which are called falsy values — they all evaluate to false in conditionals:
- the number
0. (and -0) - the BigInt
0n - the keyword
null - the keyword
undefined - the boolean
false - the number
NaN - the empty string
>""(equivalent to>''or>``)
Strictly speaking, you have to “coerce” (force) a falsy value to make it false, for example by using Boolean() or the
Of course, the idea of there being falsy values in JavaScript begs the question, what are truthy values in JavaScript?
Truthy values are going to be everything else — anything that is not falsy evaluates to true in a conditional.
Truthy values include the empty object {} and the empty array [] — since they aren’t falsy, they are truthy, by definition.
Code example of falsy values
Here is a complete list of falsy comparisons using the loose equality (==) double equals comparison operator:






