Sobes.tech
Junior

What values are considered falsy in JavaScript?

sobes.tech AI

Answer from AI

In JavaScript, falsy values are those that become false when converted to a boolean. They include:

  • false
  • 0 (zero)
  • -0 (negative zero)
  • 0n (BigInt zero)
  • "" (empty string)
  • null
  • undefined
  • NaN

All other values are considered truthy.

Example:

if (!0) {
  console.log('0 — falsy value');
}
if ("hello") {
  console.log('"hello" — truthy value');
}
What values are considered falsy in JavaScript… - sobes.tech