One: Grammar
JavaScript: A client-side scripting language based on object and event-driven;
Consists of the following three:
1,ecmascript (a ECMA International (formerly European Computer Manufacturers Association, European Computer Manufacturers Association, through ECMA-262 standardized scripting language);
2,bom (abbreviation of browser object model, referred to as the browser);
The 3,dom (Document Object model, the documentation objects models, referred to as DOM) is a standard programming interface recommended by the Consortium for processing extensible logo languages.
1 statement; execution order; annotation; introduction method; variable definition;
2) data type;
A:string, String type, enclosed in single double quotes for a string of characters (numbers, letters, symbols);
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, only a special value of NULL, representing a null object pointer, you can set the variable 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 operators in:&& (with), | | (OR),! (non);
D: assignment operator: =,+=,-=,*=,/=,%=;
E: string and variable concatenation characters: "+";
F: Self-added (+ +), self-reduction (-);
4) type to replace;
String conversion Number: parseint ()---Converts other types to integers; parsefloat ()---Converts other types to floating-point (decimal);
5) Select structure;
Program three flow control: order, Branch (selection), loop;
1) If statement:
Single branch; double branch;
multiple branches; nested structure;
Note: the () after if () can not be omitted, {} in the branch cannot be omitted; If nesting does not exceed three layers
A: Single branch--if condition judgment statement;
B: multiple branches;
2) Swith statement;
Note: The default branch must be written in the Swith statement to prevent ambiguity in the maintenance of the following;
The probability of execution is greater than the front (if,case)
If else is different from the Swith, the former is branched with fewer nesting, the latter with more branches.
6 The conditional operator: The only three-wood operator, which requires three operands;
Format: expression 1? Expression 2: Expression 3;
First solution expression 1, if true, then execute expression 2, otherwise, execute expression 3;
7) circulation structure;
Loop: Repeated execution of a thing, given the conditions set up, repeated execution, know the condition does not establish failure to stop.
A:while cycle;
B:do while loop;
C:for cycle;
D:break and Countinue;
The above is the entire content of this article, I hope to help you, thank you for the support of cloud habitat community!