Created
January 22, 2018 15:42
-
-
Save JakeTheCorn/e6f579a876136733a219245198a9a2cc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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