参考答案:
1Function.prototype.call = function(context = window, ...args) { 2 if (typeof this !== 'function') { 3 throw new TypeError('Type Error'); 4 } 5 const fn = Symbol('fn'); 6 context[fn] = this; 7 8 const res = context[fn](...args); 9 delete context[fn]; 10 return res; 11} 12
最近更新时间:2021-07-07