call
Each func will inherit methods such as call apply.
function print(mesage){console.log(mesage);return message;}print.call(this, "cnblogs");//cnblogscall(thisAgr,agr1,agr2...) , call method is the first to pass a context context. The following is the number of parameters.
apply
apply(thisAgr,[agr1,agr2]), apply method is the same as call, except that the passed parameters will be different. .
function print(a,b){console.log(a + b);}print.apply(this, ["hello","cnblogs"]);bind
bind is to bind the function to touch an object.
<script>function f(y) { alert(this.x + y); }var o = { x: };var g= f.bind(o);g();//</script>Summary
Calling the call apply function is the same as using function calls directly.
call apply can also imitate the bind method.
<script>function f(y) { alert(this.x + y); }var o = { x: };f.call(o, );//f.apply(o, []);//</script>The above is the relevant knowledge introduced by the editor to you about JavaScript (10) The usage description of call apply bind. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply to you in time. Thank you very much for your support to Wulin.com website!