Created
March 19, 2020 02:15
-
-
Save joe-oli/b40ead6678c189f0a28ff1a72043eba7 to your computer and use it in GitHub Desktop.
Truthy vs Falsy in JS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From http://www.sitepoint.com/javascript-truthy-falsy/ | |
The following values are always falsy: | |
* false | |
* 0 (zero) | |
* "" (empty string) | |
* null | |
* undefined | |
* NaN (a special Number value meaning Not-a-Number!) | |
All other values are truthy !! this includes: | |
"0" (zero in quotes), | |
"false" (false in quotes), | |
empty functions, | |
empty arrays, | |
and empty objects. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment