---restore content starts---
1. js function calls have 4 modes: Method invocation, normal function call, constructor function call, Apply/call call.
At the same time, no matter what function call except for the formal parameters that you define when you declare, you will automatically add 2 parameters, respectively this and arguments
。
2, the Apply:apply function receives 2 parameters, the first one is passed to this function to bind the value of this, the second is a parameter
Array.
Call and apply exist in order to change the binding of this.
Note: The difference is that the call is followed by an indeterminate argument, not an array.
Look at the code:
function A (xx, yy) { alert (xx, yy); Alert (this); alert (arguments); } A.apply (null, [5, +]); A.call (null
3. Call and apply will execute the function immediately, and the second bind will not, it will generate a new function.
Other and call look, see the code:
var m = { "x": 1 }; function foo (y) { alert (this. x+ y); } Foo.apply (M, [5]); 5); var foo1 = Foo.bind (M, 5);
Clairvoyant
Source: http://rangercyh.blog.51cto.com
"JavaScript" [bind,call,apply] (function cal () {} ()); declaring the function to execute immediately