All functions have call (), apply (), and bind () methods. They can point to this with a value when executing the method and change the object-oriented scope.
Apply method:
The following two types of expressions are equivalent:
Func (ARG1,ARG2,ARG3)
Func.apply (Null,[arg1,arg2,arg3])
Apply () is often used when a function needs to accept multiple arguments in the form of an array.
Use Math.max () to get the largest element in an array:
Math.max.apply (null,[17,33,21]);
Call Method:
Expression: Call ([thisobj[,arg1[, arg2[, [,. ArgN]]])
Definition: Invokes one method of an object, replacing the current object with another object.
Description: Call () can achieve a variety of functions, such as 1. The ShowName () method that originally belonged to the animal object is given to another object, cat, to use; 2. Implementing Inheritance (Single-inheritance, multiple-inheritance) 3. Replace one function with another.
Bind method:
Http://www.zhangxinxu.com/wordpress/2012/10/ecmascript-es5-bind-array-slice-call-apply/is the most comprehensive, The most interesting explanation about the bind method is that it is not better to teach than to grant the fish.
Control function calls in JS: Call (), apply () and bind ()