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

后端 未结 22 2241
醉话见心
醉话见心 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:34

    Use bind for future calls to the function. Both apply and call invoke the function.

    bind() also allows for additional arguments to be perpended to the args array.

    https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_objects/Function/bind

提交回复
热议问题