All Downloads are FREE. Search and download functionalities are using the official Maven repository.

g2601_2700.s2693_call_function_with_custom_context.solution.ts Maven / Gradle / Ivy

The newest version!
// #Medium #Array #Dynamic_Programming #Matrix #2023_07_28_Time_51_ms_(97.92%)_Space_43_MB_(91.84%)

declare global {
    interface Function {
        callPolyfill(context: Record, ...args: any[]): any
    }
}

Function.prototype.callPolyfill = function (context, ...args): any { //NOSONAR
    let fn = this.bind(context)
    return fn(...args)
}

/*
 * function increment() { this.count++; return this.count; }
 * increment.callPolyfill({count: 1}); // 2
 */

export {}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy