Created
August 21, 2018 07:49
-
-
Save KamMif/2d6a531b447d1055747fad9c11f78f8b 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
const times10 = n => n * 10; | |
const cache = {}; | |
const memoTimes10 = n => { | |
if (n in cache) { | |
return cache[n]; | |
} | |
else { | |
let res = times10(n); | |
cache[n] = res; | |
return res; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment