Falsy
<!-- cSpell:ignore falsey -->
<!-- cSpell:ignore falsey -->
A **falsy** (sometimes written **falsey**) value is a value that is considered false when encountered in a Boolean context.
JavaScript uses type conversion to coerce any value to a Boolean in contexts that require it, such as conditionals and loops.
The following table provides a complete list of JavaScript falsy values:
| Value | Type | Description |
| --------------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| null | Null | The keyword [`null`](/docs/Web/JavaScript/Reference/Operators/null) — the absence of any value. |
| undefined | Undefined | [`undefined`](/docs/Web/JavaScript/Reference/Global_Objects/undefined) — the primitive value. |
| `false` | Boolean | The keyword [`false`](/docs/Web/JavaScript/Reference/Lexical_grammar#reserved_words). |
| NaN | Number | [`NaN`](/docs/Web/JavaScript/Reference/Global_Objects/NaN) — not a number. |
| `0` | Number | The Number zero, also including `0.0`, `0x0`, etc. |
| `-0` | Number | The Number negative zero, also including `-0.0`, `-0x0`, etc. |
| `0n` | BigInt | The BigInt zero, also including `0x0n`, etc. Note that there is no BigInt negative zero — the negation of `0n` is `0n`. |
| `""` | String | Empty [string](/docs/Web/JavaScript/Reference/Global_Objects/String) value, also including `''` and ` `` `. |
| document.all | Object | The only falsy object in JavaScript is the built-in document.all. |
The values `null` and `undefined` are also nullish.
## Examples
Examples of _falsy_ values in JavaScript (which are coerced to false in Boolean contexts, and thus _bypass_ the `if` block):
```js
if (false) {
// Not reachable
}
if (null) {
// Not reachable
}
if (undefined) {
// Not reachable
}
if (0) {
// Not reachable
}
if (-0) {
// Not reachable
}
if (0n) {
// Not reachable
}
if (NaN) {
// Not reachable
}
if ("") {
// Not reachable
}
```
### The logical AND operator, &&
If the first object is falsy, it returns that object:
```js
console.log(false && "dog");
// ↪ false
console.log(0 && "dog");
// ↪ 0
```
## See also
- Related glossary terms:
- Truthy
- Coercion
- Boolean
- [Boolean coercion](/docs/Web/JavaScript/Reference/Global_Objects/Boolean#boolean_coercion)
Cite this
"Falsy". MDN Web Docs. CC BY-SA 2.5 (MDN). https://developer.mozilla.org/en-US/docs/Glossary/Falsy JSON record · API collection · BibTeX · RIS · CSL-JSON · citation policy