Higher-Order Functions

Implement Memoize

easyJS SpecificJS / TS4 tests

Problem Statement

Implement a `memoize` function that takes a function `fn` and returns a memoized version that caches results based on arguments stringification.

Examples

Example:
let callCount = 0;
const memoizedFn = memoize((a, b) => { callCount++; return a + b; });
memoizedFn(2, 2); // 4
memoizedFn(2, 2); // 4 (cached, callCount stays 1)
JavaScript & TypeScript starter code included
Run this as a live interview

Practice solo

4 test cases. No second person needed.

Get new interview exercises

Practice problems and review drills, sent when we publish new ones. No spam.

Unsubscribe anytime. We never share your address.