JavaScript Truthy/Falsy Checker

Enter any JavaScript value and instantly see whether it is truthy or falsy. The checker shows the result of Boolean(value), the typeof output, and a plain-English explanation of why the value behaves the way it does. Everything runs client-side — nothing leaves your browser.

Parsed value:
typeof:
Boolean(value):

Common Surprises

These values often catch developers off guard. Click any row to load it into the checker.

ValueTypeResultWhy?
"0"stringTRUTHYNon-empty string — the character 0 is still content
" "stringTRUTHYContains a space — only the truly empty string "" is falsy
[]arrayTRUTHYArrays are objects — all objects are truthy
{}objectTRUTHYObjects are always truthy, even when empty
"false"stringTRUTHYIt is a non-empty string, not the boolean false
"null"stringTRUTHYIt is a non-empty string, not the null primitive

Try These Examples

  • "" (empty string) — Falsy
  • 0 (number zero) — Falsy
  • "hello" (non-empty string) — Truthy
  • "0" (string zero) — Truthy!
  • [] (empty array) — Truthy!
  • null — Falsy
  • undefined — Falsy
  • NaN — Falsy
  • -0 (negative zero) — Falsy
  • 0n (BigInt zero) — Falsy

All Falsy Values in JavaScript

JavaScript has exactly 8 falsy values. Every other value — including empty arrays, empty objects, and the strings "0" and "false" — is truthy.

ValuetypeofNotes
falsebooleanThe boolean literal false
0numberNumeric zero
-0numberNegative zero — a distinct value from 0 in IEEE 754
0nbigintBigInt zero
""stringEmpty string (both '' and `` are equivalent)
nullobject*Intentional absence of a value (typeof null is "object" due to a historical bug)
undefinedundefinedVariable declared but not assigned, or missing function argument
NaNnumberNot-a-Number — result of invalid arithmetic like 0/0

Truthy and Falsy in Practice

Conditionals (if statements)

When JavaScript evaluates the condition in an if statement, it implicitly converts the value to a boolean. Falsy values cause the if block to be skipped; truthy values cause it to execute:

if ("") {
  // never runs — empty string is falsy
}

if ("hello") {
  // always runs — non-empty string is truthy
}

if ([]) {
  // always runs — empty arrays are truthy!
}

Logical AND (&&)

The && operator returns the first falsy operand, or the last operand if all are truthy. This is commonly used for short-circuit evaluation:

const name = user && user.name;
// If user is null (falsy), name = null
// If user is an object (truthy), name = user.name

Logical OR (||)

The || operator returns the first truthy operand, or the last operand if all are falsy. A common pattern for default values:

const port = config.port || 3000;
// If config.port is 0 (falsy!), port = 3000 — a subtle bug

Notice the gotcha above: 0 is a valid port number but it is falsy. This is exactly the kind of issue you can investigate with the Equality Checker.

Nullish Coalescing (??)

The ?? operator only falls through on null or undefined (the “nullish” values), not on other falsy values like 0 or "":

const port = config.port ?? 3000;
// If config.port is 0, port = 0 (preserved!)
// If config.port is null or undefined, port = 3000

Understanding the difference between falsy and nullish is critical for writing robust JavaScript. Use || when you want to replace any falsy value; use ?? when you only want to replace null and undefined.

Why Are Empty Arrays and Objects Truthy?

In JavaScript, truthiness is determined by the value’s type, not its contents. Arrays and objects are reference types — they are always truthy because a reference to an object is never “empty” in a boolean sense. Even [] and {} point to real objects in memory. To check if an array is empty, test arr.length === 0. To check if an object has no keys, use Object.keys(obj).length === 0.

You can see how these values compare to each other using our Equality Checker, and understand how asynchronous checks with truthy values flow through the Event Loop Visualiser.

Frequently Asked Questions

What are all the falsy values in JavaScript?

JavaScript has exactly 8 falsy values: false, 0, -0, 0n (BigInt zero), "" (empty string), null, undefined, and NaN. Every other value is truthy — including empty arrays [], empty objects {}, the string "0", and the string "false".

Why is an empty array truthy?

Arrays are objects in JavaScript, and all objects are truthy. An empty array [] is still a valid object reference, so Boolean([]) returns true. If you need to check whether an array has items, test its .length property instead: if (arr.length) { … }.

What is the difference between falsy and nullish?

Falsy values are the 8 values that become false when coerced to a boolean. Nullish values are a much smaller set — only null and undefined. The nullish coalescing operator (??) and optional chaining (?.) treat only nullish values specially, whereas logical OR (||) treats all falsy values the same way. This distinction matters when 0 or "" are valid values you want to preserve.

Is my data sent to a server?

No. This truthy/falsy checker runs entirely in your browser using JavaScript. There are no API calls, no server processing, and no data storage. You can verify this by opening the Network tab in your browser’s developer tools while using the tool.

Related Tools

← Back to all tools