SOURCE

Function.prototype.myApply=function (context,args){
    context = context||window;
    const unikey = Symbol('unikey');
    context[unikey]= this;
    const result = context[unikey](...args)
    delete context[unikey]
    return result;
}
function greet(greeting) {
  console.log(`${greeting}, ${this.name}`);
}

const person = { name: 'Alice' };

// 使用 myCall 来调用 greet 函数,并指定上下文对象为 person
greet.myApply(person, ['Hello']); // 输出: Hello, Alice
console 命令行工具 X clear

                    
>
console