- When calling a function, in addition to passing the parameters in the function definition explicitly declared outside, while passing two implicit parameters: arguments and this.
- arguments parameter is a collection of all the parameters passed into the function. Having a length property, that is the number of parameters passed, those parameters may also be obtained with the function parameter arguments do not match the parameters through. In the non-strict model, the object is an alias function parameter arguments, modifications modify arguments object argument function, by avoiding modification strict mode function arguments.
- this context indicates the object function, i.e., associated with the function call. And define how the function is called by the decision of this point.
- There are 4 function is called in
- As a function call
- Invoked as an object method
- As a constructor call
- Call by call and apply methods
- This function is called by the impact of values
- If called as a function, in non-strict mode, this points to the global object window; this point undefined in strict mode.
- udnefined type [object Undefined]
- Using this embodiment acquires specific data of the data type
Object.prototype.toString.call(数据)
- As an object method calls, this usually points to the object call.
- As a constructor call, this usually points to the object (instance of an object) newly created.
- Call or apply by calling, this points to the first parameter of the call or apply.
- If called as a function, in non-strict mode, this points to the global object window; this point undefined in strict mode.
- Arrow functions no separate this value, determined in this function to create an arrow.
- All functions can use the bind method, create a new function, and bound to the bind method parameters passed. Call the bind method does not modify the original function, but to create a new function.
Function call and its effect this point
Guess you like
Origin www.cnblogs.com/itxcr/p/11600183.html
Recommended
Ranking