JavaScript

Truthy and Falsy

Definition

In JavaScript, every value is either truthy or falsy when evaluated in a boolean context. Falsy values are: `false`, `0`, `''`, `null`, `undefined`, `NaN`, and `0n`. Everything else is truthy, including empty arrays and objects.

Code Example

Javascript
Tip: Modify the code above and click “Run” to see the results

Learn More

Related Terms