fe-note
fe-note copied to clipboard
手动实现一个bind函数
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))
}
}