JavaScript Basics (If, if else, else if, while, switch...case statements)

Source: Internet
Author: User
Tags case statement

- , 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

    • ? Jump 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)

Related Article

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.