fe-note icon indicating copy to clipboard operation
fe-note copied to clipboard

手动实现一个bind函数

Open NuoHui opened this issue 4 years ago • 0 comments


 Function.prototype.bind = function (ctx) {
        const _otherParam = Array.prototype.slice.call(arguments, 1)
        const _this = this
        return function customBind () {
          const _params = Array.prototype.slice.call(arguments)
          _this.apply(ctx, [].concat(_otherParam, _params))
        }
      }

NuoHui avatar Sep 09 '20 11:09 NuoHui