The World of Remnant

js手写apply

Function.prototype.apply = function (context = window, args = []) {
    let fn = Symbol()
    context[fn] = this
    let result = context[fn](...args)
    Reflect.deleteProperty(context, fn)
    return result
}