Skip to Content
Mastering JavaScript Functional Programming
book

Mastering JavaScript Functional Programming

by Federico Kereki
November 2017
Intermediate to advanced
386 pages
9h 22m
English
Packt Publishing
Content preview from Mastering JavaScript Functional Programming

Higher order functions revisited

Classic FP techniques do not use iteration at all, but work exclusively with recursion as the only way to do some looping. Let's revisit some of the functions that we already saw in Chapter 5, Programming Declaratively - A Better Style, such as map(), reduce(), find(), and filter(), to see how we can make do with the only recursion.

We are not planning to exchange the basic JS functions for ours, though: it's highly likely that performance will be worse for our recursive polyfills and we won't derive any advantages just from having the functions use recursion. Rather, we want to study how iterations are performed in a recursive way, so our efforts are more pedagogical than practical, OK?

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering JavaScript Functional Programming - Second Edition

Mastering JavaScript Functional Programming - Second Edition

Federico Kereki

Publisher Resources

ISBN: 9781787287440Supplemental Content