Start reading Functional JavaScript on your Kindle in under a minute. Don't have a Kindle? Get your Kindle here or start reading now with a free Kindle Reading App.

Deliver to your Kindle or other device


Try it free

Sample the beginning of this book for free

Deliver to your Kindle or other device

Anybody can read Kindle books—even without a Kindle device—with the FREE Kindle app for smartphones, tablets and computers.
Functional JavaScript: Introducing Functional Programming with Underscore.js

Functional JavaScript: Introducing Functional Programming with Underscore.js [Kindle Edition]

Michael Fogus
5.0 out of 5 stars  See all reviews (1 customer review)

Print List Price: £19.50
Kindle Price: £8.03 includes VAT* & free wireless delivery via Amazon Whispernet
You Save: £11.47 (59%)
* Unlike print books, digital books are subject to VAT.


Amazon Price New from Used from
Kindle Edition £8.03  
Paperback £19.50  
Kindle Daily Deal
Kindle Daily Deal: At least 60% off
Each day we unveil a new book deal at a specially discounted price--for that day only. Learn more about the Kindle Daily Deal or sign up for the Kindle Daily Deal Newsletter to receive free e-mail notifications about each day's deal.

Product Description

Product Description

How can you overcome JavaScript language oddities and unsafe features? With this book, you’ll learn how to create code that’s beautiful, safe, and simple to understand and test by using JavaScript’s functional programming support. Author Michael Fogus shows you how to apply functional-style concepts with Underscore.js, a JavaScript library that facilitates functional programming techniques. Sample code is available on GitHub at

Fogus helps you think in a functional way to help you minimize complexity in the programs you build. If you’re a JavaScript programmer hoping to learn functional programming techniques, or a functional programmer looking to learn JavaScript, this book is the ideal introduction.

  • Use applicative programming techniques with first-class functions
  • Understand how and why you might leverage variable scoping and closures
  • Delve into higher-order functions—and learn how they take other functions as arguments for maximum advantage
  • Explore ways to compose new functions from existing functions
  • Get around JavaScript’s limitations for using recursive functions
  • Reduce, hide, or eliminate the footprint of state change in your programs
  • Practice flow-based programming with chains and functional pipelines
  • Discover how to code without using classes

About the Author

Michael Fogus is software developer with experience in distributed simulation, machine vision, and expert systems construction. He's actively involved in the Clojure and Scala communities.

Product details

More About the Author

Discover books, learn about writers, and more.

What Other Items Do Customers Buy After Viewing This Item?

Customer Reviews

4 star
3 star
2 star
1 star
5.0 out of 5 stars
5.0 out of 5 stars
Most Helpful Customer Reviews
5 of 5 people found the following review helpful
5.0 out of 5 stars Worth reading if you use Javascript 26 Oct 2013
By Mike
Format:Paperback|Verified Purchase
This book certainly isn't perfect. There are several minor errors in the printed code and output examples, so you probably want a good enough understanding of Javascript to be able to pick them out. Towards the beginning I found it would ramble in places and lead off on some odd tangents. Also, some of the examples comparing functional to imperative code seemed to unfairly attribute good programming practices to functional style. Examples include: returning early and avoiding the use of superfluous variables. Despite a few minor issues I still rate this book highly as I learnt lots of new and interesting things from it.

Underscore provides a set of useful functions that allow you to write shorter, more expressive code. If you are familiar with the ECMA5 array methods map, reduce and filter then you can expect browser independent implementations of those along with a load of additional utility method that can help simplify data transformations. If that is all new to you it may be worth having a play around with them before taking a look at the Underscore site.

Some of the content in the middle of the book repeats some of the stuff I have read in other Javascript books, such as The Good Parts, Javascript Patterns and Effective Javascript, but here the author does a better job of showing practical uses for functional style and explains what aspects of functional programming Javascript is best suited to. Up until now I hadn't really understood why i would want to use currying. It usually gets presented in its arbitrary length form as something you can do, but without reason as to why. Learning about partial application was one of the most fun bits, it allows you to write programs in a very different form.
Read more ›
Comment | 
Was this review helpful to you?
Most Helpful Customer Reviews on (beta) 4.2 out of 5 stars  24 reviews
27 of 28 people found the following review helpful
5.0 out of 5 stars just might change how you approach problems with JS 19 Jun 2013
By R. Friesel Jr. - Published on
Format:Kindle Edition
My name is on the back cover, and that blurb probably says it all but...

I had the privilege of reading some early drafts of this book and seeing it take shape. Fogus has written an outstanding book here and one that I could see joining the ranks of canonical JS texts like JavaScript: The Good Parts, Professional JavaScript for Web Developers, and JavaScript: The Definitive Guide (aka "el Rhino Diablo"). Just like Underscore is a surprisingly-small-yet-surprisingly-powerful library, so this book is surprisingly dense. This probably shouldn't be your first JavaScript book, but if you're familiar with the language already, then this is an excellent introduction to the functional programming paradigm, as well as how to apply those concepts to JavaScript. I'm particularly impressed with how accessible he makes some of these concepts (e.g., pipelining, trampolines, protocols) which can sometimes seem a bit... obtuse and academic. Fogus really shows how these powerful techniques can be used with great effect in JavaScript, but also how JavaScript itself makes some of these concepts possible (and even trivial) to implement.

Seriously: JavaScript is everywhere, it's the lingua franca of the web, and as we do more powerful things in the browser, we're going to need more powerful programming paradigms. "Functional JavaScript" helps show the way.
62 of 74 people found the following review helpful
3.0 out of 5 stars Learn Underscore first 2 July 2013
By Greg Bulmash - Published on
In the foreword, the author makes an argument for why he finds Underscore so useful for writing functional JavaScript, then says "while I use Underscore extensively (and endorse it), this is not a book about Underscore, per se." This translates to "I'm going to use Underscore a lot in my code samples, but I'm not going to explain a bit of it."

But by the time you're 17 pages in, you're running into sample code like "return, _.first)."

If you don't have a grounding in Underscore, you will hit a wall early on and have to choose between pausing to get a grounding in underscore or throwing the book away entirely.

Hopefully this review gives you the option of making that choice BEFORE buying the book.
14 of 16 people found the following review helpful
4.0 out of 5 stars "Functional Javascript" by Michael Fogus; O'Reilly Media 17 July 2013
By BoMoKo - Published on
Disclaimer - I got this book through the O'Reilly blogger review program, however, I had planned on purchasing this book since I first heard of it, the fact I got it through the program was simply a bonus.

In his new book, Fogus attempts the twofold task of introducing his audience to functional programming in general, and demonstrating how one can achieve a functional style using Javascript and the underscore.js library in particular.

Reading this book was my first sustained investigation into functional programming proper. I had heard it mentioned in various contexts through the years, but as far as real reading into the topic, I doubt that I had done more than simply skimmed the functional programming wikipedia page.

I had, naively, expected to be faced with something entirely foreign when I initially opened the book. What I found, though, is probably best compared to the first time you listen to jazz music after years of listening to rock. All the parts are the same, the musicians use the same instruments, making the same sounds, but use them in ways that are both familiar but, in some sense, radically different at the same time.
In terms of example code provided, it will be comprehensible to anyone familiar with javascript, one might simply be struck by the _way_ things are done. They may seem unnatural at first, but once one starts to get a feeling for the functional style it becomes clear how functional programming makes it easier to reason clearly about your code, something that (it is obvious to me now) is much more difficult in the good old fashioned OOP or imperative programming paradigms.

I have no gripes about the book, I picked up a few minor typos - these are to be expected in a first printing, and have all seemed to already been reported. All in all I think it's a fantastic addition to the JS literature and should be read by any JS programmer who is serious about writing extensible, scalable code.

I see myself returning to this book again and again - I can think of no higher compliment for technical writing.
17 of 22 people found the following review helpful
2.0 out of 5 stars Still doesn't explain why, or give context 1 Sep 2013
By Michael - Published on
I've really been trying to get into functional programming. I really have. Conceptually, it's not too difficult, and I can understand everything presented in the book no problem.

But this book, like everything else I've come across regarding functional programming, gives me absolutely zero reason to use it in the wild. Like everything else, all its examples are basically about sorting lists, etc., and very little to do with what 99% of real-world JavaScript programming is.

In no place in the book does the author explain *why* you should use the functional style instead of imperative, or *when* you should, and when you shouldn't, or how to properly balance the two.

There are zero examples that are actually applicable to the real world. Show me how you'd build a simple webapp that tracks and categorizes songs in your music library, for example, and show me how you'd build it functionally, and show me what advantages this has to building it imperatively. Show me interaction with a database or a web service, and what advantages FP has.

Because, as far as I can tell, FP is a whole lot harder to debug (at least in JavaScript), a whole lot harder to maintain, and it's main strengths are geared towards parallel processing -- which, obviously, does not exist in JavaScript.

So this book tells me *how* to do FP in JS, but I am still left clueless and baffled as to why you would ever, or when it's appropriate and when it's not.
4 of 4 people found the following review helpful
5.0 out of 5 stars very in-depth, based underscore.js 11 July 2013
By ab85 - Published on
Format:Kindle Edition|Verified Purchase
almost all examples include underscore.js which great, you learn both functional javascript and how underscore.js takes care of a lot of stuff already.
Were these reviews helpful?   Let us know
Search Customer Reviews
Only search this product's reviews

Customer Discussions

This product's forum
Discussion Replies Latest Post
No discussions yet

Ask questions, Share opinions, Gain insight
Start a new discussion
First post:
Prompts for sign-in

Search Customer Discussions
Search all Amazon discussions

Look for similar items by category