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

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

    bind: It binds the function with provided value and context but it does not executes the function. To execute function you need to call the function.

    call: It executes the function with provided context and parameter.

    apply: It executes the function with provided context and parameter as array.

提交回复
热议问题