OPERATORS AND LOOPS
OPERATORS
Assignment Operators:
An assignment operator assigns a value to its left operand (data value) based on the value of its right operand. The simple assignment operator is equal (=).
Comparison Operators:
A comparison operator compares its operands and returns a logical value based on whether the comparison is true. The operands can be numerical, string, logical, or object values. Strings are compared based on standard lexicographical ordering, using Unicode values. In most cases, if the two operands are not of the same type, JavaScript attempts to convert them to an appropriate type for the comparison. This behavior generally results in comparing the operands numerically.
LOOPS
Loops offer a quick and easy way to do something repeatedly. There are many different kinds of loops, but they all essentially do the same thing: they repeat an action some number of times.
-
For Statement Loop: A for statement loop repeats until a specified condition evaluates to false. The initializing expression usually initializes one or more loop counters, but the syntax allows an expression of any degree of complexity. This expression can also declare variables. Then the condition expression is evaluated. If the value is true, the loop statements execute. Otherwise, the loop terminates.
-
While Statement Loop A while statement loop repeats until a specified condition evaluates to false. It is always executed once before the condition is checked. If the condition is true, the statement executes again. At the end of every execution, the condition is checked. When the condition is false, execution stops, and control passes to the following statement.