USE FLOW CONTROL

All programming languages include statements that control the flow of the program under various conditions. The if-else statement is the one most commonly used, and it works just the way you'd expect: If this happens, do A, else if that happens, do B.

Conditional operators are used to create conditions in your scripts. JavaScripts's conditional operators are shown in the following table.

Conditional Operator Description
==
equality (what's to the left of this operator is exactly the same as what's to the right)
<
less than
>
greater than
<=
less than or equal to
>=
greater than or equal to
!=
not equal to

The assignment operator (=) is an arithmetic operator. The equality operator (==) is a conditional operator. One of the most common mistakes in beginning JavaScript is to use the assignment operator in a condition rather than the equality operator.