题解 | #Function.bind#

Function.bind

https://www.nowcoder.com/practice/ecad0164931847f78c55278cee56e544

 Function.prototype._bind = function (context, ...args) {
        let arg = args ? args : [];
        let _this = this;
        const fbound = function (...innerArgs) {
          return _this.apply(this instanceof fbound ? this : context, [
            ...args,
            ...innerArgs,
          ]);
        };
        fbound.prototype = this.prototype;
        return fbound;
      };

全部评论

相关推荐

1 收藏 评论
分享
牛客网
牛客企业服务