JavaScript Allongé

A strong cup of functions, objects, combinators, and decorators

"This is a must-read for any developer who wants to know Javascript better... Reg has a way of explaining things in a way that connected the dots for me. This is probably the only programming book I've re-read cover to cover a dozen times or more."—etrinh

2029 readers

100% Happiness guarantee Learn more

Minimum: $19.99

Suggested: $29.99+

Ways to buy

  • Free toread online

  • 2029 readers
  • 250 pages
  • 45,223 words
  • 100% complete
  • Book language: English
  • Cc-by-sa
  • Updated

About the Book

What readers are saying

“I think it’s one of the best tech books I’ve read since Sedgewick’s Algorithms in C.” Andrey Sidorov

“Your explanation of closures in JavaScript Allongé is the best I've read.” Emehrkay

“It's a different approach to JavaScript than you'll find in most other places and shines a light on some of the more elegant parts of JavaScript the language.” @jeremymorrell

And listen to the JavaScript Jabber Book Club Podcast about JavaScript Allongé!

Why they're saying it:

JavaScript Allongé solves two important problems for the ambitious JavaScript programmer. First, JavaScript Allongé gives you the tools to deal with JavaScript bugs, hitches, edge cases, and other potential pitfalls.

There are plenty of good directions for how to write JavaScript programs. If you follow them without alteration or deviation, you will be satisfied. Unfortunately, software is a complex thing, full of interactions and side-effects. Two perfectly reasonable pieces of advice when taken separately may conflict with each other when taken together. An approach may seem sound at the outset of a project, but need to be revised when new requirements are discovered.

When you “leave the path” of the directions, you discover their limitations. In order to solve the problems that occur at the edges, in order to adapt and deal with changes, in order to refactor and rewrite as needed, you need to understand the underlying principles of the JavaScript programming language in detail.

“This book is awesome and blowing my mind in a great way.” Johnathan Mukai

You need to understand why the directions work so that you can understand how to modify them to work properly at or beyond their original limitations. That’s where JavaScript Allongé comes in.

JavaScript Allongé is a book about programming with functions, because JavaScript is a programming language built on flexible and powerful functions. JavaScript Allongé begins at the beginning, with values and expressions, and builds from there to discuss types, identity, functions, closures, scopes, and many more subjects up to working with classes and instances. In each case, JavaScript Allongé takes care to explain exactly how things work so that when you encounter a problem, you’ll know exactly what is happening and how to fix it.

“Enjoying Javascript Allonge... I think it's the best discussion of functional programming in js I've found so far.” Nicholas Faiz

Second, JavaScript Allongé provides recipes for using functions to write software that is simpler, cleaner, and less complicated than alternative approaches that are object-centric or code-centric. JavaScript idioms like function combinators and decorators leverage JavaScript’s power to make code easier to read, modify, debug and refactor, thus avoiding problems before they happen.

JavaScript Allongé teaches you how to handle complex code, and it also teaches you how to simplify code without dumbing it down. As a result, JavaScript Allongé is a rich read releasing many of JavaScript’s subtleties, much like the Café Allongé beloved by coffee enthusiasts everywhere.

“Reading JavaScript Allongé by @raganwald. This book is so good that it's blowing my mind.” Guillermo Pascual

You can read the book online, download the free sample pdf or better still, buy the ebook today. There's a no-questions-asked 100% money-back guarantee, so you can read it worry-free.

And Coming Soon: JavaScript Spessore

Buy A Bundle, And Save

  • JavaScript Allongé cover page
    • CoffeeScript Ristretto cover page
    • Kestrels, Quirky Birds, and Hopeless Egocentricity cover page

    Coffee, Kestrels & Code

    3 books for $83.97 $34.99

  • JavaScript Allongé cover page
    • Rapid Prototyping with JS cover page

    JavaScript Allongé and Rapid Prototyping with JS

    2 books for $64.98 $29.99

  • JavaScript Allongé cover page
    • Functional Programming for the Object-Oriented Programmer cover page

    Thinking Functionally in JavaScript

    2 books for $49.99 $24.99

  • JavaScript Allongé cover page
    • Principles of Object-Oriented Programming in JavaScript cover page

    Advanced JavaScript from Principles to Practices

    2 books for $49.98 $29.99

About the Author

The Leanpub Unconditional, No Risk, 100% Happiness Guarantee


Within 45 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks. We process the refunds manually, so they may take a few days to show up. See full terms.

If you buy a Leanpub book you get all the updates to the book for free! All books are available in PDF, EPUB (for iPad) and MOBI (for Kindle). There is no DRM. There is no risk, just guaranteed happiness or your money back.

Other books by this author

Table of Contents

  • A Pull of the Lever: Prefaces
    • Foreword by Michael Fogus
    • Foreword by Matthew Knox
    • Why JavaScript Allongé?
    • A Personal Word About The Recipes
    • Legend
  • Prelude: Values and Expressions
    • values and expressions
    • values and identity
  • 1 The first sip: Basic Functions
    • As Little As Possible About Functions, But No Less
    • Ah. I’d Like to Have an Argument, Please.
    • Closures and Scope
    • Let’s Talk Var
    • Naming Functions
    • Combinators and Function Decorators
    • Building Blocks
    • I’d Like to Have Some Arguments. Again.
    • Summary
  • 2 The Recipe Cheat Sheet
  • 3 Recipes with Basic Functions
    • Partial Application
    • Ellipses and improved Partial Application
    • Unary
    • Tap
    • Maybe
  • 4 The Pause That Refreshes: Rebinding and References
    • Arguments and Arrays
    • References and Objects
    • Reassignment and Mutation
    • How to Shoot Yourself in the Foot With Var
    • When Rebinding Meets Recursion
    • From Let to Modules
    • Summary
  • 5 Recipes with Rebinding and References
    • Once
    • mapWith
    • Flip
    • Extend
    • Why?
  • 6 Stir the Allongé: Objects, Mutation, and State
    • Encapsulating State with Closures
    • Composition and Extension
    • This and That
    • What Context Applies When We Call a Function?
    • Method Decorators
    • Summary
  • 7 Recipes with Objects, Mutations, and State
    • Memoize
    • getWith
    • pluckWith
    • Deep Mapping
  • 8 Finish the Cup: Instances and Classes
    • Prototypes are Simple, it’s the Explanations that are Hard To Understand
    • Binding Functions to Contexts
    • Partial Application, Binding, and Currying
    • A Class By Any Other Name
    • Object Methods
    • Extending Classes with Inheritance
    • Summary
  • 9 Recipes with Instances and Classes
    • Currying
    • Bound
    • Unbinding
    • Send
    • Invoke
    • Fluent
    • Once Again
  • 10 Sequence
    • Introduction: Compose and Pipeline
  • 11 New Ideas
    • How Prototypes and Constructors differ from Classes
    • New-Agnostic Constructors
    • Another New-Agnostic Constructor Pattern
    • Mixins
    • Class Decorators
    • Interlude: Tortoises, Hares, and Teleporting Turtles
    • Functional Iterators
    • Refactoring to Functional Iterators
    • A Drunken Walk Across A Chequerboard
    • Trampolining
  • 12 Recipes for New Ideas
    • Before
    • After
    • Provided and Except
    • A Functional Mixin Factory
    • A Class Decorator Factory
    • Iterator Recipes
  • The Golden Crema
    • Author’s Notes
    • How to run the examples
    • Thanks!
    • CoffeeScript Ristretto
    • Copyright Notice
    • About The Author

Last updated

This Book is for Sale Through Leanpub

Authors and publishers use Leanpub to publish amazing in-progress and completed books like this one.



Leanpub has a wide selection of in-progress and completed books available to browse, purchase, and enjoy.

Browse the Bookstore


Leanpub is free for authors and publishers to use. We pay authors or publishers 90% royalties minus 50 cents per sale.

Write a Book