Pager
Each func inherits methods such as call apply.
function print (mesage) { console.log (mesage); return mesage; } Print.call (This, "cnblogs");//cnblogs
Call (Thisagr,agr1,agr2 ...), which is the first pass of a context context. The number of arguments is followed.
Apply
Apply (THISAGR,[AGR1,AGR2]), the Apply method is the same as the use of call, except that the parameters passed are different:
function print (b) { Console.log (a + b); } Print.apply (This, ["Hello", "cnblogs"]);
Bind
Bind is to bind the function to a touch object.
<script> function f (y) {alert (this.x + y);} var o = {x:1}; var g= f.bind (o); g (2);//3 </script>
Summary
Call the Apply function is the same as using the function call directly.
Call apply can also mimic the bind method.
<script> function f (y) {alert (this.x + y);} var o = {x:1}; F.call (o, 2);//3 f.apply (O, [3]);//4 </script>
JavaScript work must know (10) call apply Bind