Java Script Loop
A. For loop
Basic format: for (initialize variable; conditional control; increment) {Loop statement}
Execution sequence: 1. Initialize variable 2. Determine if the condition 3 conforms to the execution Loop statement 4 increment or decrement
Advanced: Multi-layer nested for loop outermost loop one layer at a time the whole cycle and so on
Features: Can control the number of cycles
Two. While loop
Basic format: while (loop condition) {Looping statement}
Execution Loop: 1 determine if the loop condition 2 conforms to the Loop statement execution loop condition
Features: If and loops are combined
Three. Do......while Cycle
Basic format: do{Loop statement}while (loop condition)
Execution loop: 1 unconditionally execute a LOOP statement 2 determine the loop condition to determine whether to start 1 cycles later
Features: unconditional execution of a cycle
Four. Two commands to jump out of a loop
Break: Jump out of the loop
Contione: Jump out of this cycle
Java Script Loop