手动实现JS中的apply函数

    
        Function.prototype.iApply = function() {
            let [newContext, args] = arguments;
            if (!newContext) newContext = window;
            args = args || [];
            newContext.fn = this;
            let result = eval(newContext.fn(...args));
            delete newContext.fn;
            return result;
        }
    
手动实现JS中的apply函数
Share this