Skip to content

Instantly share code, notes, and snippets.

@wayneseymour
Created February 18, 2014 13:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wayneseymour/9070767 to your computer and use it in GitHub Desktop.
Save wayneseymour/9070767 to your computer and use it in GitHub Desktop.
JS Truthy Falsey
### 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