Function.prototype.apply = function(thisArg = window, args) {
if (typeof this !== 'function') throw ('not a function');
thisArg.fn = this;
let res = thisArg.fn(...args);
delete thisArg.fn;
return res;
}
js手写apply
最新推荐文章于 2024-04-07 21:09:54 发布