6. What are falsy values?

Falsy values are values considered in JavaScript falsy in context of conditions. There are 6 of them and they are undefined, null, NaN, 0, "" (empty string) and false.

It means converting it to Boolean will end with getting false.

let counter = 0; if (0 || "" || undefined || null || false || NaN) { counter++; } console.info(counter); // 0 console.info([0, "", undefined, null, false, NaN].map(Boolean)); // [false, false, false, false, false, false]

Be careful - it doesn't mean all of these values are equal to false

console.info(0 == false); // true console.info("" == false); // true console.info(false == false); // true console.info(NaN == false); // false console.info(undefined == false); // false console.info(null == false); // false
Struggling to find common date to meet with your friends? Try our new tool commondate.xyz
devFlipCards 2025

Do you accept cookies?

Cookies are small amounts of data saved locally on you device, which helps our website - it saves your settings like theme or language. It helps in adjusting ads and in traffic analysis. By using this site, you consent cookies usage.

Struggling to find common date to meet with your friends? Try our new tool
commondate.xyz