Chapter 6-conditional statements and loops

Source: Internet
Author: User

6.1 ① A Condition Statement is called a control flow in a script. ② Although JavaScript does not support the "elseif" keyword, it is allowed to create such statements through the IF/else statement chain. ③ The break statement is also used for the default item in the switch Condition Statement, because if it is not at the end, the subsequent case will still be executed. ④ If there is no default in case, and it is not the last one, it is called fall through (fail) ⑤ conditional operator (also called ternary operator ):

6.2 The prompt box shows the user input:

VaR username = Window. Prompt ("Give me your name! "," Default display content ");

6.5 loop: ① do while loop is a special case, because even if the comparison statement in the loop returns false for the first time, the code will be executed at least once. ② The for in loop allows you to traverse the names of all attributes in the object, while the for each in loop allows you to traverse the values of each attribute. These Chapter 8 details.

Chapter 6-conditional statements and loops

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.