Meta - Front end engineer - Phone Screen

Level: Senior
Education: Masters
Years of Experience: 10
Questions Asked:

Write a memoization function that takes a function as input and returns a memoized version of the function. The argument function can have multiple arguments and may be synchronous or asynchronous. Here is how the memoization function should work:

function sum(x,y) {
return x + y;
}
const memoizedSum = memorize(sum);
memoizedSum(5,6) // calls sum function and returns 11
memoziedSum(5,6) // does not call sum function and returns 11