Another, less serious issue in the memoization example for JS:
(cache[key] = cache[key] || fn(...args));
Will not memoize results that equal 0 or an empty string.I guess it goes to show that copying answers from stack overflow might not be the best idea, whether it's done manually or using ML.