The if statement changes the flow of the program based on the value of the expression. The then block is executed if the expression is truthy; otherwise, the optional else branch is taken.
Here are the falsy values:
- The empty string ”
- The number 0
- The number NaN
All other values are truthy, including true, the string ‘false’, and all objects.