Falsy Values
JS · Data Typessyntax
false | 0 | -0 | 0n | "" | null | undefined | NaNexample
const values = [false, 0, -0, 0n, "", null, undefined, NaN];
const truthyOnes = values.filter(Boolean);
console.log(truthyOnes.length);output
0Note Everything else is truthy, including empty objects {}, empty arrays [], and the string "false". This trips up many developers.