1. Content review
1. Today's question
2. JS
1. JS to learn the content of
1. JS Basic Syntax
2. BOM (Operation Browser)
3. DOM (manipulating document content)
2. JS Import method
1. Write the JS code directly into the script tag
2. Write the JS code into the JS file and import
3 through the SRC attribute of the script. JS Syntax Basics
1. Comments//
2. Statement to add Terminator;
3. Variable declaration $
4. Data type in JS
1. Number
NaN
parseint ()
parsefloat ()
2. String
1: Length
2: Trim ()
3. . Slice ()
4 ....
3. Boolean boolean
0, NULL, "", Undefined, NaN are false
4. Undefined
1. Variable light declaration not assigned var A;
2. function does not return a value by default returns undefined
5. Object
Null--Manually empty a variable
array
Array Common methods
Sort sort
Traverse an array-- Use the For loop to iterate through the index
6. Type query
typeof
5. Operator
1. Arithmetic operators
+ + and-
2. comparison operator
= = = Strong equals
3. Logical Operators
& & | | !
4. Assignment operator
= + = = *=/=
6. Process Control Statement
1. If ... else ...
2. If ... else if ... else ...
3. Switch (variable)
case "a":
...
break;
Default:
...
4. For loop
for (var i=0;i<10;i++) {...}
for (;;) {...}
5. While loop
while (condition) {...}
The improvement of technology is only the accumulation of quantity, and the improvement of thought is the leap of quality.
2. Today's content
1. Functions in JS
1. Three types of functions
1. General functions
2. Anonymous functions
3. Self-executing functions
2. Considerations for Functions
1. Parameters
2. Return value
3. Variable Scope
4. Lexical analysis
2. Built-in objects and methods
1. Date objects
New Date ()
Attention:
GetMonth () The value range of the returned data is 0~11
2. JSON object
Json.parse
Json.stringify
3. RegExp objects
1. Two different ways
1. New RegExp (' ^1[3-9][0-9]{9}$ ')
2./^1[3-9][0-9]{9}$/
2. Three things to note:
1. Test () does not transmit a value equivalent to a undefined,undefined will be treated as "undefined"
2. Do not add a space in the middle of an increment expression
3. Note the Lastindex property of global match mode G
4. Math Object
Front-end JavaScript