The skeleton of JavaScript--Grammatical composition (i)

Source: Internet
Author: User

JavaScript, as a weakly typed language, has a large part of its grammatical rules that are based on the C language or other C-language style functions, but each language has its own grammatical features, which form the skeleton of the language.

All names are case-sensitive.

The following two rules are required for identifiers, such as names or functions that refer to variable function properties:

  1. The first character must be a letter, an underscore (_), or a dollar sign ($);
  2. Other characters can be letters, underscores, numbers, and dollar signs.

It is also important to note that JavaScript identifiers are best used in camel-like notation.

Third, comments. similar to the C language style, there are the following two types:

This is a single-line comment


* This is a

* Multi-line

* Notes


Iv. statements. Although not strictly required, it is best to end the semicolon; code blocks with {} have better serviceability for code readability.

Keywords and reserved words. a keyword is a word that has a special purpose, and he cannot be used as an identifier, and a reserved word refers to a word that might be used as a keyword in the future. Here no more one by one repeat.

Six, variable. JavaScript variables can hold any type of data, which acts as a placeholder. For variables, it is important to note that VAR can manipulate a defined variable, but that the variable defined is a local variable, and a variable defined without VAR can be a global variable, but it is also not recommended.

The skeleton of JavaScript--Grammatical composition (i)

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: 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.