problems(js): add “2693. Call Function with Custom Context”

Signed-off-by: Matej Focko <mfocko@redhat.com>
This commit is contained in:
Matej Focko 2023-06-03 20:24:48 +02:00
parent 85b9b28037
commit 8a7ffff7d2
Signed by: mfocko
GPG key ID: 7C47D46246790496

View file

@ -0,0 +1,13 @@
/**
* @param {Object} context
* @param {any[]} args
* @return {any}
*/
Function.prototype.callPolyfill = function(context, ...args) {
return this.apply(context, args);
};
/**
* function increment() { this.count++; return this.count; }
* increment.callPolyfill({count: 1}); // 2
*/