SOURCE

Function.prototype.myApply = function (thisObj, ...args) {
    if (typeof this !== 'function') {
        throw TypeError('this is not a function');
    }
    const O = thisObj || window;
    O.fun = this;
    const result = O.fun(...args);
    delete O.fun;
    return result;
}
console 命令行工具 X clear

                    
>
console