0Pricing
JavaScript Academy · Lesson

Truthy and Falsy Values

Know which values evaluate as true or false.

Truthy and Falsy

In a boolean context such as an if statement, every JavaScript value is treated as either truthy or falsy. Falsy values behave like false; everything else is truthy.

if ("hello") {
  console.log("strings are truthy")
}

The Falsy List

There are exactly eight falsy values. Memorize them, because everything not on the list is truthy.

  • false
  • 0 and negative zero
  • empty string
  • null
  • undefined
  • NaN
  • BigInt zero
console.log(Boolean(0))
console.log(Boolean(""))
console.log(Boolean(null))

All lessons in this course

  1. Truthy and Falsy Values
  2. Loose vs Strict Equality
  3. Implicit Coercion in Operations
  4. Explicit Conversion Techniques
← Back to JavaScript Academy