FE-Interview icon indicating copy to clipboard operation
FE-Interview copied to clipboard

bind、call、apply 的区别

Open lgwebdream opened this issue 4 years ago • 2 comments

lgwebdream avatar Jul 06 '20 16:07 lgwebdream

扫描下方二维码,获取答案以及详细解析,同时可解锁800+道前端面试题。

lgwebdream avatar Jul 06 '20 16:07 lgwebdream

三个都是可以指定特定的执行上下文,不同的是 bind 是返回一个新函数,并在执行时使用指定上下文,而callapply会立即使用上下文执行函数,返回函数执行结果,他们两者只是参数形式不同

rubickecho avatar Jan 17 '22 14:01 rubickecho