Skip to content

Instantly share code, notes, and snippets.

@JakeTheCorn
Created January 22, 2018 15:42
Show Gist options
  • Save JakeTheCorn/e6f579a876136733a219245198a9a2cc to your computer and use it in GitHub Desktop.
Save JakeTheCorn/e6f579a876136733a219245198a9a2cc to your computer and use it in GitHub Desktop.
function memoizer(func) {
var cache = [];
return function(n) {
var idx = n.toString();
if (cache[idx] === undefined) {
cache[idx] = func(x);
}
return cache[idx];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment