热门

最新

红包

立Flag

投票

同城

我的

发布
cc18868876837
码飞_CC
5 年前
truecc18868876837

call方法的实现:

Function.prototype.call = function(context = window, ...args) {
if (typeof this !== 'function') {
throw new TypeError('Type Error');
}
const fn = Symbol('fn');
context[fn] = this;

const res = context[fn](...args);
delete context[fn];
return res;
}

CSDN App 扫码分享
分享
评论
2
打赏
  • 复制链接
  • 举报
下一条:
vs中,在窗口中点击按钮,时间开始或者结束。求助………………新手,这个窗口的计时器不知道怎么弄………………大佬帮帮我
立即登录