Guest User

Untitled

a guest
Jan 20th, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.22 KB | None | 0 0
  1. const memoize = fn => (...args) => {
  2. fn.cache = fn.cache || {}
  3. return fn.cache[args] ? fn.cache[args] : (fn.cache[args] = fn.apply(this,args))
  4. }
  5.  
  6. const memoizedFunction = memoize(funtionToMemoize)
  7. memoizedFunction(args)
Add Comment
Please, Sign In to add comment