Tag Archives: javascript

Values considered false in JavaScript – false, null, undefined, NaN

Unofficial JavaScript logo
The false values in JavaScript:

  • false
  • null
  • undefined
  • The empty string ”
  • The number 0
  • The number NaN (result of an operation that cannot produce a normal result)

False JavaScript Values (JSFiddle)

All other values evaluate to true, including true, the string ‘false’, and all objects.

Another tidbit about NaN is that it is not equal to any value, including itself.