let obj = {
  a:1,
  b:2
}

Function.prototype.myCall = function(content,...arg){
  let _this = this
  let sy = Symbol();
  content[sy] = _this;
  return content[sy](...arg);
}

function add(c,d){
  console.log(this.a + this.b + c + d)
}
add.myCall(obj,2,4);

posted on 2021-06-11 10:55  皮杰克  阅读(27)  评论(0编辑  收藏  举报