JavaScript based
1) concept: the client scripting language running in the browser on the client every browser with JavaScript parsing engine script language: don't need to compile directly can be executed in the browser parses the
2) function to enhance the user interaction and HTML page process can control the HTML element for page has some dynamic effects enhance the user experience
3) the basic syntax
1. The way combined with HTML
JS:
Define & lt; script> The tag body content is js code
Note 1: js in the HTML tag can declare anywhere but in the location of the affect page display
Note 2: at the same time can define multiple script
External JS
Define & lt; script> Through the SRC attribute as external js file
2. Comments
1. The single-line comments//comment content
2. The multiline comment/* comment */
3. The data type
1. The primitive data types (basic data types)
A) number number decimal NaN (integer)
B) the string string
C) Boolean
D) null
E) undefined undefined if there is no (a variable initialization)
2. The object reference data type:
4 variables: a small piece of memory space to store data
Strongly typed: when opening variable storage space, defines the spatial data type of data stored in the future, can only be stored fixed type of data
Weak type: storage space, open up the variable does not define the type of spatial data is stored in the future, you can store any type of data,
Java is a strongly typed language JavaScript is weakly typed language
Grammar: var variable name=initialization values;
The typeof operator: access to the type of the variable,
Note: null operation after got the object
5. The operator
1. The unary operator only one operand operator
+ + - + (plus)
2. The arithmetic operator + - */%..
3. The assignment operator=+=-=
4. The comparison operators & gt; <>=& lt;======(congruent type is in before you decide if the type is not the same as direct return false)
5. Logical operators & amp; & | |!
6. The ternary operator
? Expression:
Var c=a & gt; B? 1-0.
Expression? Value 1:2;
To determine the value of the expression, if it's true value is 1, if it is false value 2;
6. Process control statements
1. If the else
2. The switch (primitive data types can accept any any) 3. While
4. Do.. While
5. The for
7. JS special syntax
1. Statement to; The end if there is only one line can be omitted;
2. The definition of a variable using the var keyword can not use (if unfined must use the var)
Use var to define a local variable does not use global variables 8. Practice jiujiu multiplication table