In chapter 2, Thinking Functionally - A First Example, we went over an example of FP thinking, but let's now go to the basics, and review functions. In Chapter 1, Becoming Functional - Several Questions, we mentioned that two important JS features were functions as first-class objects and closures. Now, in this chapter, let's:
- Examine some key ways of defining functions in JS
- Go in detail regarding arrow functions, which are closest to the lambda calculus functions
- Introduce the concept of currying
- Revisit the concept of functions as first-class objects
We'll also consider several FP techniques, such as:
- Injection, as needed for sorting with different strategies and other uses
- Callbacks and promises, introducing the continuation passing style
- Polyfilling and stubbing
- Immediate invocation...