模拟call

9 天前(已编辑)

模拟call

1.模拟call


Function.prototype.mycall = function(context = window, ...args){
    if(this == Function.prototype){
        return undefined;
    }
    context = context || window;
    const fn = Symbol();
    context[fn] = this;
    const result = context[fn](...args);
    delete context[fn]
    return result
}

使用社交账号登录

  • Loading...
  • Loading...
  • Loading...
  • Loading...
  • Loading...