Functional Programming in JavaScript (Node.js)
300 pages
English
PDF
4.5

Functional Programming in JavaScript (Node.js)

Functional Programming in JavaScript (Node.js)

Author:

Year:

Summary:

The book "Functional Programming in JavaScript (Node.js)" is a practical guide for developers who want to master the functional programming (FP) paradigm in the Node.js environment. Unlike academic works, the material is focused on real-world tasks: from building reliable backend services to processing data streams.



What is this book about?

You will start with the fundamental concepts of FP:

  • Pure functions and side effects — how to separate logic from input/output and make code testable.
  • Immutability — working with immutable data structures in JavaScript (Object.freeze, Immer, Immutable.js libraries).
  • Higher-order functions — map, filter, reduce, composition, and currying.
  • Recursion and tail call optimization — replacing loops with recursive calls.

Then the book delves into advanced topics:

  • Monads — Maybe, Either, IO, Task (using the Folktale and Crocks libraries).
  • Functors and applicative functors — safe handling of null, asynchronous operations, and exceptions.
  • Lenses — convenient access and updating of nested structures.
  • Reactive programming — Observables and RxJS operators in Node.js.

Each chapter contains code examples that can be run in the Node.js 18+ environment and exercises to reinforce the material.



Who is this book for?

  • JavaScript developers familiar with the basics of Node.js who want to transition to a functional style.
  • Backend engineers who want to reduce the number of bugs and make code easily maintainable.
  • Students and graduates of courses studying modern approaches to programming.


What will you learn?

  • Write functions without hidden states — your code will become predictable.
  • Build composition from small functions, like LEGO bricks.
  • Handle errors without try/catch — using the Either monad.
  • Work with asynchrony through functional patterns (Promise, Task, Observable).
  • Apply FP in real-world scenarios: data parsing, file handling, creating REST APIs.


This book is not about "functional programming for the sake of functional programming." It is about tools that make Node.js code cleaner, more reliable, and easier to refactor. If you are tired of "callback hell" and mutating states — start reading right now.

Recommendations