call

作者: 萘小蒽 | 来源:发表于2022-07-20 09:28 被阅读0次
let person = {
  name:'二仙桥大爷',
  say(){ console.log(`我是${this.name},只能拉一点点`)}
}
let tanSer = {
  name:'谭桥',
}
Function.prototype.myCall = function(context){
   let that = context;
   that.fn = this;
   arg = [...arguments].slice(1);
  let res = that.fn(arg)
  delete that.fn
   return res;  
}

相关文章

网友评论

      本文标题:call

      本文链接:https://www.haomeiwen.com/subject/ytseirtx.html