Truthy and falsy values

Truthy Values:

“0”
“false”
empty functions
empty arrays
empty objects
typeof(null)

these above listed items are considered true in javascript

Falsy values:

false
0
“”
null
undefined
NaN(Not a number)

These are considered false.

When dealing with these truthy and falsy values we should be careful and always try to use “===” or “!==” when we need to compare .