编辑代码

// call

Function.prototype.myCall = function (context, ...args) {
    context = context || window
    context.fn = this
    const res = context.fn(...args)
    delete context.fn
    return res
}

// apply

Function.prototype.myApply = function (context, ...args) {
    context = context || window
    context.fn = this
    console.log('args', ar)
    const res = context.fn(...args[0])
    delete context.fn
    return res
}

const fn = function (a, b, c) {
    console.log(a + b + c)
}