6
Producing Functions – Higher-Order Functions
In Chapter 5, Programming Declaratively, we worked with some declarative code so that we could gain understandability and more compact, shorter code. In this chapter, we will go further toward higher-order functions (HOFs) and develop our own. We can roughly classify the results that we are going to get into three groups:
- Wrapped functions: These keep their original functionality while adding some kind of new feature. In this group, we can consider logging (adding log production capacity to any function), timing (producing time and performance data for a given function), and memoization of functions and promises (caching results to avoid future rework).
- Altered functions: These differ in some key ...
Get Mastering JavaScript Functional Programming - Third Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.