JavaScript Learning Notes Some tips _ basics

Source: Internet
Author: User

A. JavaScript Basics 

1.try...catch uses lowercase letters. Uppercase letters can go wrong.

2.Throw statement

The purpose of the throw declaration is to create a exception (exception). You can use this declaration in conjunction with the Try...catch declaration to achieve the purpose of controlling the flow of the program and generating accurate error messages.

Grammar:
Throw (Exception)
Exception can be a string, an integer, a logical value, or an object.

Note: Write throw with lowercase letters. Using uppercase letters makes an error!

3. A backslash is used to insert ellipses, line breaks, quotes, and other special characters in a text string.


The following table lists the remaining special characters that can be added to a text string using a backslash:

Code output
\ ' Single quotes
\ "Double Quotes
\& and number
\ reverse Slash
\ n Line Feed
\ r return character
\ t tab
\b Backspace
\f Page Breaks
4.JavaScript ignores extra spaces. So you can add the appropriate spaces in your code to make your code more readable.

5.

You can use backslashes to wrap code within a text string. The following example is correct:

document.write ("Hello \
world! ")
But you can't fold like this:

document.write \
("Hello world!")

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.