๐ŸŸก Truthy & Falsy Values ๐ŸŸก

Thread By @MrConerMurphy

๐ŸŸก Truthy & Falsy Values ๐ŸŸก

A large part of using JS is dealing with booleans.

Whether it is conditional rendering or an if statement. Booleans are everywhere.

For this reason, it's important to know about truthy & falsy values. Do you?

Let's check them out. ๐Ÿงต ๐Ÿ‘‡ 1/5

function _extends() { _extends = Object.assign ||

21/05/2021 09:34

โ“ What do Truthy and Falsy mean?

๐Ÿ‘‰ If we say a value is "truthy", this means that the value will be evaluated to true in a logical comparison.

๐Ÿ‘‰ Similarly, if a value is "falsy" it means that in a logical comparison it would evaluate to false.


21/05/2021 09:34

1๏ธโƒฃ Truthy Values

๐Ÿ‘‰ In JS any value by default is a truthy value unless it has been defined as a falsy value.

What this means is any time you create a value unless it's one from the list of falsy values, it will be truthy.


function _extends() { _extends = Object.assign ||

21/05/2021 09:34

2๏ธโƒฃ Falsy Values

๐Ÿ‘‰ If a value is created as one of the values on the list of falsy values then it will evaluate to false.

Unlike truthy only certain values will be falsy. Check out the ๐Ÿ–ผ๏ธ for the entire list.

๐Ÿ“š Read more about [[IsHTMLDDA]]:



๐Ÿ”— Links in this Tweet:

function _extends() { _extends = Object.assign ||

21/05/2021 09:34

Did you enjoy this thread or find it helpful? If so I would greatly appreciate it if you would consider doing one of the following:

โค๏ธ Like these tweets ๐Ÿ”„ Retweet the first tweet in this thread so others can see it. ๐Ÿ‘ค Follow me for more content like this.


21/05/2021 09:34

Email Newsletter

Want to get weekly notifications of my posts and more exclusive content?

Please consider signing up to my email newsletter.