- , Statement
Concept: a semicolon (;) represents the end of a statement
Habit: Write only one statement on a single line; write multiple statements on a line (poor code readability)
Statement BLOCK: You can include multiple statements "{}" to wrap multiple statements
U conditional statements
* If statement
* If...else Statement
* ELSE if statement
* Switch...case Statement
If statement:
If...else statement:
Switch...case statement:
The U-loop statement-----[SWITCH: Case statements are rewritten as if statements]
Concept: Controls whether [repeat] a segment specifies a block of content by a single condition
* While statement * Do...while statement
while (expression) {do {
Statement BLOCK statement block
}} while (expression)
While statement:
* The Do...while statement differs from the while statement:
* For statement
Initialize expression-Define variable content for loop control
Conditional judgment expression-used to determine whether a specified block of statements is executed repeatedly
loop control expression-the value of the variable used to manipulate the loop control
* The difference between a while statement and a for statement
Applies to do, do, and for loops
* Break statement: Represents an interrupt, used in a circular statement-indicates that the end loop can be used for a switch statement
* Continue statement: continuous; Use in loop statement-means end "This" loop
JavaScript Basics (If, if else, else if, while, switch...case statements)