$ ./guess_the_languageProblem Solving — fill the blank
Problem Solving — fill the blank · hard · #125

Fill in the blank

// returns a memoized version of fn
function memoize<T>(fn: (n: number) => T): (n: number) => T {
  const cache = new Map<number, T>();
  return (n) => {
    if (cache.____(n)) return cache.get(n)!;
    const r = fn(n);
    cache.set(n, r);
    return r;
  };
}

Answer: has (also accepted: has, has())

Map.has() checks whether a cached result already exists.
Play Problem Solving ▸