day032: 能不能模拟实现一个 bind 的效果?

实现bind以前,咱们首先要知道它作了哪些事情。app 对于普通函数,绑定this指向ide 对于构造函数,要保证原函数的原型对象上的属性不能丢失函数 Function.prototype.bind = function (context, ...args) { // 异常处理 if (typeof this !== "function") { throw new Error("Functi
相关文章
相关标签/搜索