Behaving Properly - Pure Functions

In Chapter 3, Starting Out with Functions - A Core Concept, we considered functions as the key elements in FP, went into detail about arrow functions, and introduced some concepts such as injection, callbacks, polyfilling, and stubbing. Now, in this chapter, we'll have the opportunity to revisit or apply some of those ideas, while we also...

  • Consider the notion of purity, and why we should care about pure functions
  • Examine the concept of Referential Transparency
  • Recognize the problems implied by side effects
  • Show some advantages of pure functions
  • Describe the main causes of impure functions
  • Find ways to minimize the number of impure functions
  • Focus on ways of testing both pure and impure functions

Get Mastering Javascript Functional Programming 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.