Skip to content

Instantly share code, notes, and snippets.

@fuchao2012
Created April 10, 2017 10:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fuchao2012/2144c5b9d9beb028197519e429677d0f to your computer and use it in GitHub Desktop.
Save fuchao2012/2144c5b9d9beb028197519e429677d0f to your computer and use it in GitHub Desktop.
bind apply call 的区别

相同点

apply 、 call 、bind 三者都是用来改变函数的this对象的指向的; apply 、 call 、bind 三者第一个参数都是this要指向的对象,也就是想指定的上下文; apply 、 call 、bind 三者都可以利用后续参数传参;

不同点

bind 是返回对应函数,便于稍后调用;

apply 、call 则是立即调用 。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment