Skip to content

Instantly share code, notes, and snippets.

@Dammic
Created November 7, 2017 18:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Dammic/814657f3ebe956d30d9e081a31001e0b to your computer and use it in GitHub Desktop.
Save Dammic/814657f3ebe956d30d9e081a31001e0b to your computer and use it in GitHub Desktop.
memoize
function memoized(number) {
if (number === memoized.prototype.previousNumber) {
return memoized.prototype.previousValue;
}
memoized.prototype.previousNumber = number;
memoized.prototype.previousValue = { value: number };
return memoized.prototype.previousValue;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment