Opens in a new tab
A picture of Jeff Brigman
I CODE TODAY FOR
A BETTER TOMORROW

Glossary Term

Truthy

3 tags 1 category

In JavaScript, a truthy value is a value that is considered true when encountered in a Boolean context. All values are truthy unless they are defined as falsy. That is, all values are truthy except false, 0, -0, 0n, “”, null, undefined, NaN, and document.all.

Examples of truthy values in JavaScript (which will be coerced to true in boolean contexts, and thus execute the if block):

If the first operand is truthy, the logical AND operator returns the second operand:

Term Connections

Explore related terms connected by shared tags, shared categories, and relationship phrases. This map loads only when it comes into view.

Loading term connections…