Truthy and Falsy values are considered true or false when used in a boolean context.

Image for post
Image for post

Falsy values:

1. false
2. 0
3. -0
4. 0n
5. ""
6. null
7. undefined
8. NaN

Truthy values:

Any value other that the above falsy values are truthy


Boolean("") => falseBoolean("hello") => trueBoolean(0) => falseBoolean(12) => trueBoolean([]) => trueBoolean({}) => true
const authToken = ""
const greeting = authToken ? "Please Log In" : "Welcome Back!"=> "Welcome Back!"


Jesse Langford

Former golf instructor turned software engineer. 4 years ago I left my job teaching golf in Beijing to pursue my passion for writing code.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store