59

面试官问:能否模拟实现JS的call和apply方法

 5 years ago
source link: https://juejin.im/post/5bf6c79bf265da6142738b29
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
之前写过两篇《面试官问:能否模拟实现JS的new操作符》和《面试官问:能否模拟实现JS的bind方法》 其中模拟bind方法时是使用的call和apply修改this指向。但面试官可能问:能否不用call和apply来实现呢。意思也就是需要模拟实现call和a

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK