Follow me to "JavaScript elevation 3" Third Lecture: 4th Chapter
Course production: Bling, Xing elder brother, 5 years java,3 years front-end course Knowledge: JavaScript, Html, CSS course goal: The front-end system course, gradually go deep, find a front-end work Course Outline: The book directory Structure for the crowd: front-end beginners, can 0 basis, but to be serious, practical
Course Review
1. Data type: 5 basic types, 1 complex types. 2, Operator: need to pay attention to the operation of priority, the logic of the turn to tease. 3, statements: If-else, for, for-in, while4, functions: function definition, the two current methods
Add: Variables are referred to as global variables and local variables after the function is explained.
Several tips for the editor
1, quickly establish a variety of static projects required files: CSS, HTML, js2, static file template settings 3, HTML tags commonly used a shortcut key, just one.
Course Note 1, base type, and value of reference type
The basic types of variables are flexible, updating types at any time, but not recommended; complex types of variables that can be added and deleted at any time; the basic types of replication are value passing, not interfering with each other; replication of complex types is reference passing and interfering with each other. The parameter of the function, if it is the basic type, is the value pass, does not disturb the variable passed in; However, the complex type passes the reference, passing the address, like a pointer in the C language, modifies the properties of the original object. Another common operator for complex type detection is instanceof, which is more granular and harder to judge. Knowledge Point: When passing a complex type, be sure to pay attention to it.
2. Scope
Local variables: function internal global variables: external functions (easy to understand interpretation), usually stored under the Window object. There is no block-level action, only the inside of the function and outside the function. Variable queries, which are looked up from within, so the use of global variables takes into account efficiency issues.
3. Garbage collection
JavaScript automatically recycles, note a little, and try to remove the non-applicable global variables.
Homework after class
1, write the function, through the transmission of basic types and complex types, experience the difference between the two; imitate the book of the P71 program, 2, write functions, master global variables and local variables. Simulate the p73 and p74 page programs in the book.
Follow me to "JavaScript elevation 3" Third, course notes