Falsy
adjective
say it: “FAWL-see” /ˈfɔːlsi/
A JavaScript value that counts as false in a condition: false, 0, "", null, undefined or NaN.
What is Falsy in JavaScript?
Falsy — A value treated as false when JavaScript evaluates it as a condition.
const itemCount = 0;
let cartEmpty = false;
if (!itemCount) {
cartEmpty = true;
}
In a sentence
- “An empty string is falsy, so if (name) skips the block when nothing was typed.”
Level: Novice · More JavaScript terms at this level
Updated