Skip to content

Instantly share code, notes, and snippets.

@KamMif
Created August 21, 2018 07:49
Show Gist options
  • Save KamMif/2d6a531b447d1055747fad9c11f78f8b to your computer and use it in GitHub Desktop.
Save KamMif/2d6a531b447d1055747fad9c11f78f8b to your computer and use it in GitHub Desktop.
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