1, a complete JavaScript should be composed of three parts: the core (ECMAScript), the Document Object Model (DOM), the browser object model (BOM), 2, ECMAScript in the internal use of a class array to represent, the function received is always this class array , in the function body can access this parameter array through the arguments object, arguments object is actually an array of classes, not an instance of array, Hong Kong virtual host, can be accessed by square brackets syntax, but also can use the length method;
With respect to arguments, its value is always kept in sync with the value of the corresponding named parameter, because the values in the arguments object automatically react to the corresponding named parameters, that is, modify the arguments[1] and modify the num2, but that is not to say that they have the same memory space, Their memory space is independent, this effect is unidirectional, modifying the named parameter does not change the corresponding value in the arguments, also keep in mind that if only one parameter is passed, the value set by arguments[1] will not be reflected in the named parameter. This is because the length of the arguments is determined by the parameters passed in, not by the number of named arguments defined by the function, and the named parameter that does not pass the value is automatically assigned the undefined value;
2, although the main purpose of arguments is to save the function parameters, but this object also has a property called Callee, the property is a pointer to a function that has arguments object.
The initial value of the Callee property is the function object that is being executed. The Callee property is a member of the arguments object that represents a reference to the function object itself, which facilitates the recursion of anonymous functions or ensures the encapsulation of functions, and it is important to note that Callee has the length property, The arguments.length is the length of the argument, and the arguments.callee.length is the length of the formal parameter, thus determining whether the parameter length is consistent with the argument length at the time of invocation.
3. For a function, the caller property is defined only when the function is executed. Caller This property holds the function scope that invokes the current function;
4. Functions in ECMAScript are objects, so functions also have properties and methods, each function contains two attributes, length and prototype, where the length property represents the number of named arguments the function expects to receive;
5. For reference types in ECMAScript, prototype preserves all of their instance methods, such as ToString (), ValueOf (), and so on, which are actually stored under prototype;
6, each function contains two non-inherited methods: Call () and apply (), Web site space, the purpose is to invoke a function in a particular scope, is actually equivalent to set the value of the This object in the function body, the function is bound to another object to execute.
The call () method and the Apply () method are the same, they differ only in the manner of receiving parameters, for the call () method, the first parameter this does not change, Hong Kong virtual host, the change is passed to the function parameters must be enumerated;
The real strength of the call () and apply () methods is the ability to extend the scope of the function, and the object does not need to have any coupling with the method;
Detailed arguments, callee, caller, call, apply the difference