Created
February 18, 2014 13:16
-
-
Save wayneseymour/9070767 to your computer and use it in GitHub Desktop.
JS Truthy Falsey
This file contains 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
### JavaScript Truthy Falsey | |
---------- | |
#### JavaScript treats all these values as Truthy: | |
* true | |
* 1 (because it’ s a non-zero number) | |
* "0" (because it’ s a non-empty string) | |
* "false" (because it’ s a non-empty string) | |
* function() {} (any function) | |
* {} (any object) | |
* [] (any array) | |
#### And these values are Falsey: | |
* false | |
* 0 (the number zero) | |
* "" (an empty string) | |
* null | |
* undefined | |
* NaN (a special number value meaning Not a Number) | |
---------- | |
> Written with [StackEdit](https://stackedit.io/). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment