手动实现JS中的Call函数

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