What are falsy values in JavaScript?

The falsy values in JavaScript are 0, 0n, null, undefined, false, NaN, and the empty string "". They evaluate to false when coerced by JavaScript’s typing engine into a boolean value, but they are not necessarily equal to each other.

Dr. Derek Austin 🥳
Coding at Dawn
Published in
4 min readOct 7, 2019

--

Photo by Matej Drha on Unsplash

Falsy values in JavaScript

“A falsy value is a value that is considered false when encountered in a Boolean context.” — Mozilla Developer Network

In JavaScript, there is a special list of following 7 values, which are called falsy values — they all evaluate to false in conditionals:

Strictly speaking, you have to “coerce” (force) a falsy value to make it false, for example by using Boolean() or the ? ternary operator.

--

--

Dr. Derek Austin 🥳
Coding at Dawn

Hi, I'm Doctor Derek! I've been a professional web developer since 2005, and I love writing about programming with JavaScript, TypeScript, React, Next.js & Git.