Java Script Loop

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.