One: Grammar
JavaScript: A client-side scripting language based on object and event-driven;
Consists of the following three:
1,ecmascript (a European computer Manufacturers Association by the ECMA International, formerly the European Association of Computer manufacturers, through the ECMA-262 standardized scripting language);
2,bom (abbreviation for browser object model, referred to as a browser-based);
The 3,dom (Document Object model, the documentation-based, or DOM) is the standard programming interface recommended by the Organization for the processing of extensible flag languages.
1) statement; execution order; annotation; introduction method; variable definition;
2) data type;
A:string, String type, enclose a string of characters (numbers, letters, symbols) in single and double quotes;
B:number, numeric type, integer value, floating point number;
C:boolean, Boolean type, value is true/false;
d:undefined,undefined type, only Undefined a value, the default value for the variable;
E:null, there is only one special value null, which represents an empty object pointer, which can be set to Null to clear the variable;
F:object, object, reference type, also called complex type.
3) logical operators;
A: arithmetic operator: +,-,*,/,%;
B: relational operator: >,>=,<,<=,==,===,! =,!==;
C: logical operator in:&& (with), | | (OR),! (non);
D: assignment operator: =,+=,-=,*=,/=,%=;
E: string and variable concatenation: "+";
F: Self-added (+ +), self-reduction (-);
4) type loading and replacement;
String conversion numbers: parseint ()---Convert other types to integers, parsefloat ()---Convert other types to floating-point (decimals);
5) Select the structure;
Program three flow control: order, Branch (select), cycle;
1) If statement:
Single branch; double branch;
multiple branches; nested structures;
Note: If after () cannot be omitted, the branch {} cannot be omitted; If nesting does not exceed three layers
A: Single branch--if conditional judgment statement;
B: Multi-branch;
2) Swith statement;
Note: The default branch must be written in the Swith statement to prevent ambiguity in the subsequent maintenance;
Put more execution probabilities in front (if,case)
If else and swith differ, the former is branched with less nesting and the latter with more branches.
6) Condition Operator: The only three-wood operator, which requires three operands;
Format: expression 1? Expression 2: Expression 3;
The expression 1 is first, if true, the expression 2 is executed, whereas the expression 3 is executed;
7) cyclic structure;
Loop: Repeat one thing, given the conditions set up, repeated execution, know that the condition is not established failure stop.
A:while cycle;
B:do while loop;
C:for cycle;
D:break and Countinue;
JavaScript Syntax Summary