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:
false0(zero)-0(negative zero)0n(BigInt zero)""(empty string)nullundefinedNaN
All other values are considered truthy.
Example:
if (!0) {
console.log('0 — falsy value');
}
if ("hello") {
console.log('"hello" — truthy value');
}