4 Writing composable, pure code

This chapter covers

  • Refactoring imperative coding to a declarative, functional style
  • Mastering JavaScript’s higher-order functions
  • Introducing pure functions and immutability
  • Combining pure logic with curry and composition
  • Improving readability and structure of code with a point-free style
  • Creating native function chains with the pipeline operator

If you want to see which features will be in mainstream programming languages tomorrow, then take a look at functional programming languages today

—Simon Peyton Jones

If objects are the fabric of JavaScript, functions represent the needles used to thread the pieces together. We can use functions in JavaScript to describe collections of objects (classes, constructor ...

Get The Joy of JavaScript 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.