1. Core (ECMAScript) (syntax, type, statement, keyword, reserved word, operator, object, etc.) Ie6, 7, 8 third edition (ECMA-262) compatible
2. Document Object Dom (ie6-7 basic DOM level (basic operation can),)
3. Browser object model BOM (control browser display no standards, each browser is not the same level of support)
Supplemental browser kernel Learn about and pick the test environment IE browser Kernel Trident, Mozilla Gecko, Google WebKit, opera kernel presto (now using WebKit), Safari WebKit
is case sensitive.
The so-called identifier refers to the name of a variable, function, property, or parameter of a function. Identifiers can be one or more characters that are combined by the following formatting rules:
1. The first character must be a letter, an underscore (_), or a dollar sign ($).
2. Other characters can be letters, underscores, dollar signs, or numbers.
3. You cannot use keywords, reserved words, true, false, and NULL as identifiers.
For example: MyName, book123, etc.
ECMAScript uses C-style annotations, including single-line comments and block-level annotations.
* This is a multi-line
Keywords (characters used by the program, keywords are reserved, cannot be used as variable names or function names)
Abstract,boolean,byte,char,class,const,debugger,double,enum,export,extends,final,float,goto,implements,import, Int,interface,long,native,package,private,protected,public,short,static,super,synchronized,throws,transient, Volatile
The ECMAScript variable is loosely typed, and the so-called loose type is used to hold any type of data. Use the var operator when defining variables (Var is key), followed by a variable name (the variable name is an identifier)
var box;//create variable not initialized
alert (box);//The system will give it a special value--undefined (means undefined)
Initialization is generally required when declaring variables
Variable is the amount that can be changed again after initialization. ECMAScript is a weakly typed (loosely typed) language that can change the amount of different types at the same time. (PS: Although different types of quantities can be changed, this is difficult for later maintenance and performance is not high)
Repeat using VAR to declare a variable, but it is an assignment operation, and does not give an error. There is no need.
You can omit semicolons when each statement is in a different row. (Although ECMAScript supported, but a very bad programming habit).
var box= '
var age= 100
You can use a statement to define multiple variables, as long as each variable (initialization or uninitialized can be) separated by commas, for readability, each variable, preferably another row, and the second variable and the first variable alignment (beautiful).
var box= ',
Age = 1,
When the variable declaration does not use VAR declaration that the variable will become a global variable under the same Window object, there will be a variety of post-maintenance, and team development problems as far as possible to avoid
JS Basics 1. Simple JS syntax keyword reserved word variable