Skip to content
engineering workbench.by StudyPort Academy
All glossary terms

GLOSSARY · A WORD, UNPACKED

truthy and falsy

how JavaScript treats a value when a boolean decision is required.

A little more detail

false, 0, -0, 0n, an empty string, null, undefined, and NaN are falsy. Ordinary objects and arrays, even empty ones, are truthy. A non-empty string such as "false" is truthy too. Check the actual condition you mean, such as an array’s length, instead of using truthiness as a general validity test.

See it in practice

These lessons pair the idea with examples you can change and run.