"content":"<p>Enhance all functions to have the <code>callPolyfill</code> method. The method accepts an object <code>obj</code> as it's first parameter and any number of additional arguments. The <code>obj</code> becomes the <code>this</code> context for the function. The additional arguments are passed to the function (that the <code>callPolyfill</code> method belongs on).</p>\n\n<p>For example if you had the function:</p>\n\n<pre>\nfunction tax(price, taxRate) {\n const totalCost = price * (1 + taxRate);\n console.log(`The cost of ${this.item} is ${totalCost}`);\n}\n</pre>\n\n<p>Calling this function like <code>tax(10, 0.1)</code> will log <code>"The cost of undefined is 11"</code>. This is because the <code>this</code> context was not defined.</p>\n\n<p>However, calling the function like <code>tax.callPolyfill({item: "salad"}, 10, 0.1)</code> will log <code>"The cost of salad is 11"</code>. The <code>this</code> context was appropriately set, and the function logged an appropriate output.</p>\n\n<p>Please solve this without using the built-in <code>Function.call</code> method.</p>\n\n<p> </p>\n<p><strong class=\"example\">Example 1:</strong></p>\n\n<pre>\n<strong>Input:</strong>\nfn = function add(b) {\n return this.a + b;\n}\nargs = [{"a": 5}, 7]\n<strong>Output:</strong> 12\n<strong>Explanation:</strong>\nfn.callPolyfill({"a": 5}, 7); // 12\ncallPolyfill sets the "this" context to {"a": 5}. 7 is passed as an argument.\n</pre>\n\n<p><strong class=\"example\">Example 2:</strong></p>\n\n<pre>\n<strong>Input:</strong> \nfn = function tax(price, taxRate) { \n return `The cost of the ${this.item} is ${price * taxRate}`; \n}\nargs = [{"item": "burger"}, 10, 1.1]\n<strong>Output:</strong> "The cost of the burger is 11"\n<strong>Explanation:</strong> callPolyfill sets the "this" context to {"item": "burger"}. 10 and 1.1 are passed as additional arguments.\n</pre>\n\n<p> </p>\n<p><strong>Constraints:</strong></p>\n\n<ul style=\"list-style-type:square;\">\n\t<li><code><font face=\"monospace\">typeof args[0] == 'object' and args[0] != null</font></code></li>\n\t<li><code>1 <= args.length <= 100</code></li>\n\t<li><code>2 <= JSON.stringify(args[0]).length <= 10<sup>5</sup></code></li>\n</ul>\n",
"envInfo":"{\"javascript\": [\"JavaScript\", \"<p><code>Node.js 16.13.2</code>.</p>\\r\\n\\r\\n<p>Your code is run with <code>--harmony</code> flag, enabling <a href=\\\"http://node.green/\\\" target=\\\"_blank\\\">new ES6 features</a>.</p>\\r\\n\\r\\n<p><a href=\\\"https://lodash.com\\\" target=\\\"_blank\\\">lodash.js</a> library is included by default.</p>\\r\\n\\r\\n<p>For Priority Queue / Queue data structures, you may use 5.3.0 version of <a href=\\\"https://github.com/datastructures-js/priority-queue/tree/fb4fdb984834421279aeb081df7af624d17c2a03\\\" target=\\\"_blank\\\">datastructures-js/priority-queue</a> and 4.2.1 version of <a href=\\\"https://github.com/datastructures-js/queue/tree/e63563025a5a805aa16928cb53bcd517bfea9230\\\" target=\\\"_blank\\\">datastructures-js/queue</a>.</p>\"], \"typescript\": [\"Typescript\", \"<p><code>TypeScript 5.1.6, Node.js 16.13.2</code>.</p>\\r\\n\\r\\n<p>Your code is run with <code>--harmony</code> flag, enabling <a href=\\\"http://node.green/\\\" target=\\\"_blank\\\">new ES2022 features</a>.</p>\\r\\n\\r\\n<p><a href=\\\"https://lodash.com\\\" target=\\\"_blank\\\">lodash.js</a> library is included by default.</p>\"]}",