if/else statement, and also
switch, a more complicated
multiway branch statement.
if statement is the
decisions, or, more precisely, to execute statements conditionally.
This statement has two forms. The first is:
In this form,
evaluated. If the resulting value is truthy,
statement is executed. If
expression is falsy,
statement is not executed. (See Boolean Values for a definition of truthy and falsy values.)
// If username is null or undefined,
// define it
// If username is null, undefined, false, 0, "", or NaN, give it a new value
Note that the parentheses around the
expression are a required part of the
syntax for the
if keyword and parenthesized expression, but you can use a statement block to combine ...