Fourth Chapter Study
Wai Wai : December 9
I. Basic types and reference typesThe ECMAScript variable may contain values for two different data types: the underlying type value and the reference type value. the underlying type value refers to a simple data segment; A reference type value refers to an object that consists of many values1. Copy variable valuesIf this is the method of copying the underlying type value: Create a new space in the heap memory and copy that value past2. Passing ParametersThe parameters of all functions are passed by valueaccess variables are both by value and by reference, but parameters can only be passed by value3. Detection typeusually with typeofYou don't want to know that a value is an object, but you want to know what type of object it is. Well, then use instanceof .(for example, to detect whether a variable person is an object or an array or a regexp type, this time cannot be used typeof or need to use instanceof)II. implementation environment and scope1. Each function has its own execution environment2, there is a scope chain is to let the internal environment orderly, linear access to the external environment. 3. How to extend the scope chainCatch block in a try-catch statementWith statement4. Features:(i) there is no block-level scope, so-called block-level scope to make an analogyif () {}In general curly braces If you define a variable, the scope of the variable is the curly brace, which is a block(ii) query identifiersLook in your local environment first, then follow the scope chain up, until you find it and stop looking.third, garbage collection1. Identify variables that are no longer in use and release the memory they occupy(i) Mark Clear(ii) Reference count
JavaScript Learning Notes (iii)