Truthy and Falsy Values
- Any value that evaluates to true in Boolean Context is truthy value.
1console.log(Boolean("Hello World!"));2// true
- Any value that evaluates to false in Boolean Context is falsy value.
The only 6 falsy values
There are only 6 falsy values. Everything else (other than these 6 values) evaluates to true in boolean context.
1- ""2- 03- false
The above 3 values are equal to each other.
1- undefined2- null
The above 2 values loosely equalls (==) to each other and nothing else.
NaN is the only value that is not even equal to itself.
1console.log(NaN == NaN);2// false
So, that’s it for this post, I will see you in some other post. If you found this one helpful, do share it and join my newsletter below or here.