From my understanding, I believe that var a = 1; is the only truthy and the rest are falsyโ€™s - is this correct?

No.

  1. var a = 0;

    Number zero is falsy. However, note that the string zero "0" is truthy.

  2. var a = 10 == 5;

    This is same as var a = (10 == 5);, so this is falsy.

  3. var a = 1;

    var a = -1;

    Any non-zero number including negative numbers is truthy.

Quoting from MDN

In JavaScript, a truthy value is a value that translates to true when evaluated in a Boolean context. All values are truthy unless they are defined as falsy (i.e., except for false, 0, "", null, undefined, and NaN).

List of falsy values in JavaScript:From MDN

  1. false
  2. null
  3. undefined
  4. 0
  5. NaN
  6. '', "", ``(Empty template string)
  7. document.all
  8. 0n: BigInt
  9. -0
Answer from Tushar on Stack Overflow
๐ŸŒ
MDN Web Docs
developer.mozilla.org โ€บ en-US โ€บ docs โ€บ Glossary โ€บ Truthy
Truthy - Glossary | MDN
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.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ javascript โ€บ explain-the-concept-of-truthy-falsy-values-in-javascript
Explain The Concept of Truthy & Falsy Values in JavaScript - GeeksforGeeks
August 5, 2025 - This is truthy! Non-empty strings are truthy! Objects are truthy! Falsy values are values that evaluate to false when used in a Boolean. JavaScript has a fixed list of falsy values
๐ŸŒ
Sentry
sentry.io โ€บ sentry answers โ€บ javascript โ€บ truthy and falsy values in javascript
Truthy and falsy values in JavaScript | Sentry
When non-boolean values are used ... be coerced into either true or false. Values that are coerced into true are called truthy and values that are coerced into false are called falsy....
๐ŸŒ
Zipy
zipy.ai โ€บ blog โ€บ truthy-and-falsy-values-in-javascript
truthy and falsy values in javascript
April 12, 2024 - In JavaScript, every value is ... conditions in if statements or loops. Falsy values are those that evaluate to false when converted to a Boolean, while truthy values evaluate to true....
๐ŸŒ
DEV Community
dev.to โ€บ zachsnoek โ€บ what-are-truthy-and-falsy-in-javascript-j68
What Are Truthy and Falsy in JavaScript? - DEV Community
November 17, 2021 - Truthy values are values that can be coerced to true in a Boolean context, like an if statement. Falsy values are considered false in a Boolean context. That means that a value is truthy if it causes an if block or while loop to execute, for example.
๐ŸŒ
Turing
frontend.turing.edu โ€บ lessons โ€บ module-1 โ€บ js-truthy-falsy-expressions.html
JS: Truthy and Falsy Expressions - Front-End Engineering Curriculum - Turing School of Software and Design
Determine which expressions are ... control flow statement that executes code ยท Truthy values In JavaScript, a truthy value is a value that is considered true when encountered in a Boolean context....
๐ŸŒ
Medium
medium.com โ€บ @nehatanwar.dev โ€บ understanding-truthy-and-falsy-values-in-javascript-b1e18f01f3b5
Understanding Truthy and Falsy Values in JavaScript | by Nehatanwar | Medium
January 11, 2025 - These values are: ... In other words, if you use any of these values in an if or else statement, JavaScript will consider them as false. Truthy values are all values that are not falsy.
Find elsewhere
๐ŸŒ
SitePoint
sitepoint.com โ€บ blog โ€บ javascript โ€บ truthy and falsy values: when all is not equal in javascript
Truthy and Falsy Values: When All is Not Equal in JavaScript โ€” SitePoint
November 11, 2024 - We have a team of friendly experts ready to help out. In JavaScript, truthy and falsy are terms used to represent values that are considered true or false when evaluated in a Boolean context.
๐ŸŒ
freeCodeCamp
freecodecamp.org โ€บ news โ€บ javascript-if-statement-equality-and-truthy-falsy
JavaScript if Statements, Equality and Truthy/Falsy โ€“ Explained with Examples
March 21, 2023 - JavaScript has a unique sense of true and false, called truthy and falsy. Truthy and falsy are used when evaluating decision-criteria that aren't clearly true or false. Let's look at some examples.
๐ŸŒ
Reddit
reddit.com โ€บ r/learnjavascript โ€บ what are truthy and falsy values in javascript?
r/learnjavascript on Reddit: What are truthy and falsy values in javascript?
May 2, 2019 - If neither the if nor any else if are true, it'll run a default catch-all else block (assuming there's one present). ... Basically, if you evaluate an expression that isn't a boolean, it will produce a truthy/falsy value.
๐ŸŒ
CodeSignal
codesignal.com โ€บ learn โ€บ courses โ€บ introduction-to-javascript-for-front-end-engineers โ€บ lessons โ€บ decoding-javascript-truthy-and-falsy-values-conditional-statements-logical-operators-and-equality-operations
Decoding JavaScript: Truthy and Falsy Values, Conditional ...
In JavaScript, a value can be considered 'truthy' or 'falsy'. If a value is interpreted as true in a context where a boolean is expected, it is considered 'truthy'. Conversely, if it is interpreted as false, it is considered 'falsy'. For example, 1 (the number one) is truthy, while 0 (the number ...
๐ŸŒ
DEV Community
dev.to โ€บ myogeshchavan97 โ€บ javascript-basics-truthy-and-falsy-values-in-javascript-4jo2
JavaScript Basics: Truthy and Falsy values in JavaScript - DEV Community
April 26, 2021 - Truthy and Falsy values are the non-boolean values that are coerced to true or false when performing certain operations. The following are the only six values that are considered as falsy values in JavaScript.
๐ŸŒ
30 Seconds of Code
30secondsofcode.org โ€บ home โ€บ javascript โ€บ type โ€บ truthy and falsy values
What are truthy and falsy values in JavaScript? - 30 seconds of code
September 12, 2021 - JavaScript uses type coercion (implicit conversion of values from one data type to another) in Boolean contexts, such as conditionals. This means that values are considered either truthy (evaluate to true) or falsy (evaluate to false) depending ...
๐ŸŒ
Adripofjavascript
adripofjavascript.com โ€บ blog โ€บ drips โ€บ truthy-and-falsy-values-in-javascript.html
Truthy and Falsy Values in JavaScript - A Drip of JavaScript
Longtime JavaScript developers ... in JavaScript, we don't just mean that the value is true. Rather, what we mean is that the value coerces to true when evaluated in a boolean context....
๐ŸŒ
Medium
medium.com โ€บ @rabailzaheer โ€บ truthy-falsy-values-and-equality-operator-a-javascript-guide-3a0760d85cc8
Truthy & Falsy Values and Equality Operator: A JavaScript Guide | by Rabail Zaheer | Medium
September 5, 2023 - A value that is truthy will be treated as equivalent to true when encountered in a conditional statement, while a falsy value behaves as if it were false. Falsy values encompass a range of non-boolean values that are treated as false in a Boolean ...
๐ŸŒ
Educative
educative.io โ€บ answers โ€บ what-are-falsy-values-and-truthy-in-javascript
What are falsy values and truthy in JavaScript?
true or false value. This shot focuses on falsy values in JavaScript to learn what they are and how to use them. Falsy values are values that resolve to the Boolean false.
๐ŸŒ
DEV Community
dev.to โ€บ naftalimurgor โ€บ truthy-and-falsy-values-in-javascript-458p
Truthy and Falsy values in JavaScript - DEV Community
June 5, 2022 - Let's jump in! Truthy values are values that evaluate to boolean in a conditional such as if..else and switch...case. In Computer Science, a Boolean is a logical data type that can only hold the value of true or false.
๐ŸŒ
DEV Community
dev.to โ€บ osumgbachiamaka โ€บ javascript-truthy-and-falsy-values-3hm0
JavaScript Truthy and Falsy Values - DEV Community
August 22, 2020 - Then what does it mean for variables to be truthy or falsy. Falsy values are values that JavaScript's built-in type coercion converts to false or in a Boolean context are considered false.
๐ŸŒ
DEV Community
dev.to โ€บ alwaysaman โ€บ understanding-truthy-falsy-values-in-javascript-the-art-of-conditional-logic-33l9
Understanding Truthy & Falsy Values in JavaScript: The Art of Conditional Logic ๐ŸŽญ - DEV Community
October 6, 2024 - In JavaScript, truthy and falsy values determine how a value behaves in a conditional statement. Some values are automatically considered true, while others are automatically considered false.