Closed gallanwood closed 5 years ago
The example is not intended to be run as-is, it's only illustrative of the concepts that will be taught in the book. JavaScript does not have the FP utilities built-in as some FP-friendly languages do.
So, the snippet assumes presence of some functional-programming library (in this case, generically named FP
), that would provide the FP utilities needed. Libraries like Ramda and lodash-FP are examples of suitable libraries with the necessary functionality, though they use different names and in some cases their methods work slightly differently.
**Yes, I promise I did The first example runs fine in Chrome via VS Code; the FP version throws a 'FP is not defined' error. Maybe it is not intended that readers should run the code as is? Personally I like to play with the examples and yes - I don't really know what I'm doing - yet.