Loading homepage
Input: let calls = 0; const sum = memoize((...xs) => { calls++; return xs.reduce((a, b) => a + b, 0); }); sum(1, 2); sum(1, 2); calls; Output: 1
Input: const read = memoize(function (x) { return this.base + x; }); read.call({ base: 2 }, 3); Output: 5; a different receiver has a separate cache key.
Implement the exported API in index.js or index.ts. Tests cover the documented contract and edge cases.