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:
- The first character must be a letter, an underscore (_), or a dollar sign ($);
- 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)