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;
};
实现 Function.prototype.call
Posted on:2021年7月7日 at 00:13