In JavaScript, you have something called as truthy and falsy values. These are the values which are used to determine the result of a condition and thus form the basis of conditional statements. You'll learn more about the conditional statement in the next segment.
A truthy value is a value which is considered true when encountered in a Boolean context. All values are truthy unless they are defined as falsy. So, it now makes sense to see what all values are considered falsy.
Following are considered as the falsy values:
false 0 "" '' null undefined NaN
Note: All the values apart from the above-mentioned values are considered as truthy values.
For example:
true 9 -9 9.22 -9.22 "Srishti" "false" "0" Infinity -Infinity
are all considered as truthy values.