1. If statement
If statement Syntax:
If(Condition) statement1ElseStatement2
2. Iterative statements
An Iteration statement is also called a loop statement. It declares a group of commands that need to be executed repeatedly until certain conditions are met. Ecmascript provides four types of iteration statements for this processing.
2.1 Do-while statement
The do-while statement is a post-test loop, that is, the exit condition inside the execution loopCodeAfter calculation. The loop subject is executed at least once before the expression is calculated.
Do-while Syntax:
Do{Statement}While(Expression)
2.2 While statement
The while statement is a pre-test loop, that is, the exit condition is calculated before the code in the execution loop.
While Syntax:
While(Expression) Statement
2.3. For statement
The for statement is a testing loop. before entering the loop, you can initialize the variable and define the code to be executed after the loop.
For Syntax:
For(Initialization; expression; post-loop-expression) Statement
2.4 for-in statements
A for-in statement is a strict iteration statement used to enumerate the attributes of an object.
For-in syntax:
For(PropertyInExpression) Statement
3. Statements with labels
Tag statement Syntax:
Start:VaRCount = 10;
4. Break and continue statements
The break and continue statements provide stricter control over the code execution in the loop. The break statement can immediately exit the loop to prevent repeated execution of any code. The continue statement only exits the current loop and allows execution of the next loop based on the control expression.
5. With statement
The with statement is used to set the scope of code in a specific object.
With Syntax:
With(Expression) Statement
6. swith statements
Swith statement Syntax:
Swith (expression ){ Case Value: Statement Break ; Case Value: Statement Break ; Case Value: Statement Break ;...... Case Value: Statement Break ; Default : Statement Break ;}