What are truthy values in JavaScript?
Truthy values evaluate to true when coerced by JavaScript’s typing engine into a boolean value. Most values are truthy in JavaScript, including the empty array [] and the empty object {}.
Truthy values in JavaScript
“A truthy value simply means a value that is considered true when evaluated in a boolean context” — Mozilla Developer Network
Any primitive type will evaluate to true in JavaScript, with the exception of the following 7 values, which are called falsy values:
- the number
0 - the BigInt
0n - the keyword
null - the keyword
undefined - the boolean
false - the number
NaN - the empty string
“”(equivalent to``or‘’)
Values not on the list of falsy values in JavaScript are called truthy values and include the empty array [] or the empty object {}.
This means almost everything evaluates to true in JavaScript — any object and almost all primitive values, everything but the falsy values.
Specifically, they evaluate to true when given a boolean context, such as an if statement or the question mark
Code example of truthy values
The truthy values are called truthy because they evaluate to true, and the falsy values are called falsy because they evaluate to false:






