Statement:
Order : Executes from top to bottom, ending with a semicolon.
branching : Let the program execute different code depending on the condition.
If statement: Determines whether the given condition is satisfied, according to the result of the decision (true or false) decide to perform one of the two operations given.
Basic syntax:
1. if (condition) {code}.
2. if (condition) {Code}else{code}.
3. if (condition) {code}else if (condition) {Code}else{code}.
Switch...case statement:: First set the expression n (usually a variable). The value of the subsequent expression is compared to the value of each case in the structure. If there is a match, the code block associated with the case is executed. Use break to prevent your code from automatically running down a case.
Basic syntax:
Switch (variable)
{
Case x:
x= "Output Amount";
Break
Case y:
y= "Output Amount";
Break
}
Break: Jumps out of the loop, enclosing the curly braces.
Continue: Jump out of this cycle.
Cycle:
Looping through a function (executing a piece of code)
Four elements: cyclic initial value; cyclic condition; state change; Loop body.
For loop:
While loop:
Not to be continued ....
JS Statements and Arrays