Learn JavaScript II from scratch (basic concept)

Source: Internet
Author: User

Basic concept One, case-sensitive

Everything in ECMAScript (variables, function names, operators) is case-sensitive.

The variable name test and test represent two different variables, respectively.

Second, identifiers

The so-called identifier refers to the name of a variable, function, property, or parameter of a function. One or more characters that are combined by identifiers according to the following formatting 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 ECMAScript identifier is in hump case format, that is, the first letter lowercase, and the first letter of each of the remaining words is capitalized, for example: Firstsecond,mycar,dosomethingimport
Third, comments

ECMAScript uses C-style annotations, including single-line comments and block-level annotations.

    • Single-line comment: Start with two slashes such as:
// single-line comment
    • Block-level comments begin with a slash and an asterisk (/*), ending with an asterisk and a slash (*/) such as:
/* * This is a multi-line * (Block-level) Comment */
Iv. statements

The statement in ECMAScript ends with a semicolon, and if you omit the semicolon, the parser determines the end of the statement, such as:

var sum = a + b   // Even if no semicolon is a valid statement-------does not recommend var diff =-A;  // recommended---------Valid statements

Although the ending semicolon is not required, it is recommended that you do not omit it at any time.

V. Keywords and reserved words

Keywords and reserved words: characters that have a specific purpose, which can be used to denote the start or end of a control statement, or to perform a specific operation.

Keywords and reserved words: cannot be an identifier or a property name.

Learn JavaScript II from scratch (basic concept)

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.