Open In App

Explain the Concept of Truthy & Falsy Values in JavaScript ?

Last Updated : 24 Jan, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

In JavaScript, truthy and falsy values are concepts related to boolean evaluation. Every value in JavaScript has an inherent boolean “truthiness” or “falsiness,” which means they can be implicitly evaluated to true or false in boolean contexts, such as in conditional statements or logical operations.

Truthy Values: A value is considered truthy if, when coerced to a boolean, it evaluates to true. Examples of truthy values include non-empty strings, numbers other than 0, arrays, objects, and functions.

Falsy Values: Values that are not true are considered False values. 0, null, undefined, NaN, false(Boolean value), and an empty string ("").


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads