Falsy vs Truthy
Some cute terminology I ran into while doing some reading today. Falsy and Truthy. These terms describe values that evaluate to false or true in a Boolean context. I knew that this happened but didn't know that these terms existed.
I'm basically spitting out the MDN docs here but here are the complete list of JavaScript falsy and truthy values:
Falsy
| Value | Type |
|---|---|
| null | Null |
| undefined | Undefined |
| false | Boolean |
| NaN | Number |
| 0 | Number |
| -0 | Number |
| 0n | BigInt |
| "" | String |
| document.all | Object |
Truthy
- all values except that are not falsy