You can use the Boolean() function to find out if an expression (or a variable) is true: Or even easier: The chapter JS Comparisons gives a full overview of comparison operators. The chapter JS If Else gives a full overview of conditional statements. Here are some examples: More @Wikipedia
Hover over any link to get a description of the article. Please note that search keywords are sometimes hidden within the full article and don't appear in the description or title.