All questions

Advanced · JavaScript · Closures

Memoize an expensive function

Commonly asked: QA/SDET coding rounds · ~12 min

Write memoize(fn) returning a function that caches results by its arguments (use JSON.stringify(args) as the key).

Checking your membership…