third chapter
parameter
ES parameters within the array is represented by a
Array contains parameters which are not concerned
This in vivo function can be accessed by a parameter array objects arguments (Array instance is not so)
function doAdd(num1, num2) { arguments[1] = 10; alert(arguments[0] + num2); } doAdd(10); // NaN doAdd(40, 50) // 50
50 ---- arguments corresponding to the value of the named parameter values to synchronize
NaN
Arguments object length is determined by the number of passed parameters (argument) is not determined by the number of parameter
No value is passed to the named parameter values are given undefined
- The ES values for all parameters are passed, can not be passed by reference
Overload
Overloading: a function to write two definitions, as long as the two defined signature (parameter type and quantity) can be different.
- ES, there is no overloading. After defining the function defined in a front cover
Variable domain and Memory
Basic types of value type and reference
The basic type of value is based on the value of access, reference type of access by reference
Values of reference types are object stored in memory. JS memory space does not allow direct manipulation of objects.
So when the operation object, operation is referenced object. When you copy holds a variable object, the operation is a reference to the object; when you add a property to the object, the operation is the actual object. . . .
Dynamic properties, static basic types
- You can add properties to the object, but you can not add attributes to the basic types
Copy the value of the variable
-
Variable object is a special object related to the execution environment, the context in stores the following statement:
Variable (var, variable declarations)
Function declarations
Function Parameters
Copy basic types
var num1 = 5; var num2 = num1;
- Pointer few bytes representing the address bus depends on the width of the system 32 is four bytes, so it is int char type or other type or type, are four bytes.
-
- Scope and execution environment
JS Advanced Programming notes
Guess you like
Origin www.cnblogs.com/wydumn/p/11575470.html
Recommended
Ranking