![]() ![]() Notice that the recursive calls to memoizeFibonacci is explicitly passing the cache object as the second parameter, so each recursive call is sharing the same array as the top-level call, and any changes to the cache object in the recursive calls is reflected in the top-level call aswell.īTW, this type of memoization is not persistent, meaning that these two calls: memoizeFibonacci(6) ĭon't share the same cache object. Console.log(arr) // changed because of the call to foo
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |