Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const memoize = fn => (...args) => {
- fn.cache = fn.cache || {}
- return fn.cache[args] ? fn.cache[args] : (fn.cache[args] = fn.apply(this,args))
- }
- const memoizedFunction = memoize(funtionToMemoize)
- memoizedFunction(args)
Add Comment
Please, Sign In to add comment