Implement a function memoize(fn) that returns a memoized version of the given function.
The function should:
fn that can take any number of arguments.Example
function add(a, b) { console.log("computing..."); return a + b; } const memoizedAdd = memoize(add); memoizedAdd(1, 2); // "computing..." 3 memoizedAdd(1, 2); // 3, retrieved from cache
JavaScript Function
No test results yet
Click "Run" to execute tests