Javascript call() & apply() vs bind()?

后端 未结 22 2285
醉话见心
醉话见心 2020-11-22 02:42

I already know that apply and call are similar functions which setthis (context of a function).

The difference is with the way

22条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-22 03:36

    I created this comparison between function objects, function calls, call/apply and bind a while ago:

    .bind allows you to set the this value now while allowing you to execute the function in the future, because it returns a new function object.

提交回复
热议问题