Skip to content

Instantly share code, notes, and snippets.

@demisx
Created April 26, 2014 03:53
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 demisx/11311324 to your computer and use it in GitHub Desktop.
Save demisx/11311324 to your computer and use it in GitHub Desktop.
JavaScript Falsy vs. Truthy

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, including "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