Junior — Senior
Creating a wrapper function with memoization
livecode
Task condition
Implement a function memoize that takes another function as an argument and returns its "memoized" version. The returned function should store the result of execution for each unique input parameter and, on subsequent calls with the same parameter, return the stored value.
const square = (x) => x * x;
const memoize = (fn) => {};
const cached = memoize(square);
cached(4);