Skip to content

Instantly share code, notes, and snippets.

@demisx
Created April 26, 2014 03:53
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