JavaScript escape and Process Control statements

Source: Internet
Author: User
Tags switch loop

JavaScript escape character

1, for example, want to output in the page:

How does D:\Desktop\pic\baby.png do?
D:\\desktop\\pic\\baby.png

2. Common escape characters: \ t, \ n, \ ', \ ', \ \

3, there is a special place:

Alert (' Today ' weather is good ');//To display the middle double quotes, use single quotation marks on both sides, and double quotation marks on the opposite side.

Process Control Statements

The use of If-else, for, while, Do-while, switch, continue, and break are all very simple, similar to C # and Java usage.

The For loop is slightly different because JavaScript's dynamic language

Use Var when declaring variables:

for (Var i=0;i<10;i++) {...}
Switch judgment is the "= = =" of the type judgment
A chestnut:

<script type= "Text/javascript" >        var n=10;         Switch (n) {            case ': Alert (' is a string ');  break;                    }        Alert (' Wow ka ka '); // does not enter the switch loop, it will pop up this wow click. Description switch (n) is all equal to = = =, strictly judged by type    </script>

JavaScript escape and Process Control 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.