SOURCE

let obj1 = {
    name: "obj1",
    say() {
        console.log(this.name)
    }
}

let obj2 = {
    name: 'obj2'
}

Function.prototype.mycall = function(context) {
    if(typeof this !== 'function') {
        throw new Error('not a function')
    }

    context = context || window

    let arg = [...arguments].slice(1)

    context.fn = this
    let result = context.fn(...arg)
    delete context.fn
    return result
}

obj1.say.mycall(obj2)
console 命令行工具 X clear

                    
>
console