tiantingrui / daily-harvest

记录每日收获
MIT License
2 stars 0 forks source link

继承进阶:如何实现 new、apply、call、bind 的底层逻辑? #37

Open tiantingrui opened 2 years ago

tiantingrui commented 2 years ago

JavaScript 中的 apply、call 和 bind 方法是前端代码开发中相当重要的概念,并且与 this 的指向密切相关。

可以先解决下面几个问题:

  1. 用什么样的思路可以 new 关键词?
  2. apply、call、bind 这三个方法之间有什么区别?
  3. 怎样实现一个 apply 或者 call 的方法?