Truthy & Falsy values in Javascript
14 Jan 2016The specific list of “falsy” values in JavaScript is as follows:
- false
- null
- undefined
- The number 0, -0
- The empty string ‘’
- The number NaN
All other values that’s not on this “falsy” list is “truthy”. Here are some examples of those:
- true
- “abc”
- 108
- {name: “Andrew”} (objects)
- [2, 4, 6] (arrays)
- function display(){} (functions)