Tips for taking notes on JavaScript

Source: Internet
Author: User

I. JavaScript Basics

1. try... catch uses lowercase letters. An error occurs when uppercase letters are used.

2. Throw Declaration

The role declared by throw is to create an exception ). You can use this declaration with the try... catch declaration to control program streams and generate precise error messages.

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

Note: use lower-case letters to write throw. An error occurs when uppercase letters are used!

3. A backslash is used to insert ellipsis, line breaks, quotation marks, and other special characters into a text string.


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

Code output
\ 'Single quotes
\ "Double quotation marks
\ & And number
\ Backslash
\ N linefeed
\ R carriage return
\ T Tab
\ B Return character
\ F page feed
4. JavaScript ignores unnecessary spaces. Therefore, you can add appropriate spaces in the code to make the code more readable.

5.

You can use a backslash to lines the code within a text string. The following example is correct:

Document. write ("Hello \
World! ")
But it cannot be broken like this:

Document. write \
("Hello World! ")

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.