Chapter 6. Functional Programming

Functional programming is a different approach to development than the heavily object-oriented approach that we have focused on so far. Object-oriented programming is a fantastic tool to solve a great number of problems but it has some issues. Parallel programming within an object-oriented context is difficult, as the state can be changed by various different threads with unknown side effects. Functional programming does not permit state or mutable variables. Functions act as primary building blocks in functional programming. Places where you might have used a variable in the past will now use a function.

Even in a single-threaded program, functions can have side effects that change the global state. This means ...

Get Mastering JavaScript Design Patterns 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.