JavaScript Advanced Programming Learning Notes Chapter III-Basic concepts

Source: Internet
Author: User

First, the identifier:

1. Case-sensitive

2. Naming rules:

    • The first character must be a letter, an underscore (_), or a dollar sign ($)
    • Other characters can be letters, underscores, dollar signs, or numbers
    • The letters in the identifiers can also contain extended ASCII or Unicode alphabetic characters (such as À and Æ), but this is not recommended.
    • You cannot use keywords, reserved words, true, false, and NULL as identifiers

3. Writing method: It is best to write in the Hump case format, that is, the first letter lowercase, the first letter of each of the remaining words capitalized, but not forced to do so
Ii. notes (two ways)

    1. Single-line Comment://
    2. Multi-line Comment:/*......*/

Three, Strict mode: "Use Strict", a compilation instruction, used to tell the JavaScript compiler to switch to strict mode

Four, the statement:

    1. After the statement, can be omitted, but not recommended
    2. It is recommended that you use code blocks, even if there is only one statement

Keywords: break, do, instanceof, typeof, Case, else, New, Var, catch, finally, return, void, continue, for, switch, while, Debugger* (New in fifth edition) function, this, with,default, if, throw,Delete, in, try

VI. reserved words: abstract, enum, int, short,Boolean, export, Nterface, static,byte, extends, long, Supe,Char, final, native, synchronized,class, float, package, throws,const, goto, Private, transient,debugger, implements, protected, volatiledouble, import, public, let, yield (fifth edition added)

Keywords and reserved words do not as identifiers, the best name is meaningful naming, can clearly know the meaning of its representative

Eight, variable:

    1. placeholder, you can save any type of data
    2. Define variables: Use the var keyword, such as VAR message, to define a message variable
    3. Initialize variable: message= "HI";

Nine, two ways to define and initialize variables:

    1. var message= "HI";//contains two steps to define variable var message; Initialize variable message= "HI";
    2. var message;message= "HI";

JavaScript Advanced Programming Learning Notes Chapter III-Basic concepts

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.