Skip to Content
Mastering JavaScript Functional Programming - Second Edition
book

Mastering JavaScript Functional Programming - Second Edition

by Federico Kereki
January 2020
Intermediate to advanced
470 pages
11h 13m
English
Packt Publishing
Content preview from Mastering JavaScript Functional Programming - Second Edition

Memoizing functions

In Chapter 4, Behaving Properly Pure Functions, we considered the case of the Fibonacci function and learned how we could transform it, by hand, into a much more efficient version by means of memoization: caching calculated values to avoid recalculations. A memoized function is one that will avoid redoing a process if the result was found earlier. We want to be able to turn any function into a memoized one so that we can get a more optimized version.

A real-life memoizing solution should also take into account the available RAM and have some ways of avoiding filling it up; however, this is beyond the scope of this book. Also, we won't be looking into performance issues; those optimizations are also beyond the scope of ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering JavaScript Functional Programming

Mastering JavaScript Functional Programming

Federico Kereki

Publisher Resources

ISBN: 9781839213069Supplemental Content