The Joy of JavaScript
Luis Atencio
  • MEAP began March 2019
  • Publication in January 2021 (estimated)
  • ISBN 9781617295867
  • 325 pages (estimated)
  • printed in black & white

The book "Joy of JavaScript" is a joy to read. Written by the author of the excellent "Functional Programming in JavaScript", the new book goes beyond purely functional programming concepts and covers every topic a developer might need to know while reading or writing JavaScript in 2020, and it covers it well. There are plenty of examples and plenty of good explanations.

Gleb Bahmutov
Whether for building interactive browser-based applications or creating server-side applications in Node, JavaScript is the most widely used language for web programming. With new features, language improvements, paradigms, and potential use cases appearing regularly, there’s never been a more exciting time to be a JavaScript developer. In The Joy of JavaScript, author and JavaScript expert Luis Atencio teaches you key design concepts that lead to clean, lean, modular, and easy-to-maintain code.

About the Technology

As web applications have become more complex and sophisticated, JavaScript has advanced with them, thanks in large part to TC39, a JavaScript task group committed to evolving and improving the language. JavaScript has become lightweight and dynamic, with first-class functions and support for classes and asynchronous programming. JavaScript is multi-paradigm, supporting object-oriented, functional, reactive, and event-driven styles of programming. And transpilers like Babel make it possible to compile code written in other languages into JavaScript. It’s never been easier, more rewarding, or more joyful to be a JavaScript developer!

About the book

The Joy of JavaScript teaches you how to design JavaScript applications founded in sound computer science concepts and real-world industry success. First, you’ll get up close and personal with JavaScript’s object system. From there, you’ll dive into programming objects and functions. As you build various domain models, you’ll learn the pros and cons of techniques ranging from prototype-centered tightly coupled object configurations to loosely coupled delegation-based compositions. You’ll also explore ways of connecting objects with pure functions, and driving business logic with immutability and algebraic data types.

Using JavaScript’s shiny new module system and dynamically hooking into your data with Proxy and Reflect APIs, you’ll master tracing, logging, and performance trackers without having to modify your application components. You’ll also discover blockchain concepts as you develop pieces of a transaction management system. Along the way, you’ll explore topics like using JavaScript with different paradigms and how to overlay type information into JavaScript without having to switch to TypeScript. Illustrated, easy-to-grasp use cases and a hands-on peer-to-peer project lock in all you’ve learned, then take your learning further by showing you how to untangle complex asynchronous behaviors using promises, generators, and ES7 async-await syntax.
Table of Contents detailed table of contents

Part 1: Foundations

1 JavaScript Reloaded

1.1 JavaScript + Babel: past, present, and JS.Next

1.2 One language to rule them all

1.3 JavaScript’s object model

1.3.1 No blueprints, just prototypes

1.3.2 Object modeling

1.4 Sample application: an immutable transaction system

1.5 Inheritance vs composition: why not both?

1.6 Higher-order functional programming

1.6.1 Composable functions

1.6.2 Composable types

1.7 Separating concerns like a pro

1.8 Taming asynchronous behavior

1.9 Types for JavaScript?

1.10 Transpilers and modern JS

1.11 Summary

2 Prototype-centered object models

2.1 Reviewing “prototypal inheritance”

2.1.1 Property resolution process

2.1.2 Differential inheritance

2.2 Constructor functions

2.2.1 Abstracting object creation

2.2.2 The “new” gotchas

2.3 Class-based inheritance

2.3.1 Prototype inheritance !== class inheritance

2.3.2 Limitations of JavaScript’s class system

2.4 Summary

3 Delegation-based, compositional object models

3.1 Delegation patterns

3.1.1 Explicit delegation

3.1.2 Implicit delegation

3.2 Object/behavior delegation with OLOO

3.3 Understanding Object.assign

3.3.1 Object.assign uncovered

3.3.2 Assignment vs definition

3.4 Assembling objects using mixins

3.4.1 Anatomy of a mixin

3.4.2 Multiple inheritance and linearization

3.4.3 Composing objects using Object.assign and object spread

3.5 Reusable code with mixins

3.6 Summary

Part 2: Sufficient FP

4 Pure, composable functions

4.1 What is functional programming, exactly?

4.1.1 Functions as data

4.1.2 The FP manifesto

4.2 Functional versus imperative at a glance

4.3 Composition: the functional way

4.3.1 Decomposing complex code

4.3.2 Working with side effects

4.4 Lazy coding

4.4.1 Curried function application

4.4.2 The curry and composition dynamic duo

4.5 Working with immutable objects

4.6 Point-free coding

4.7 Imperative to functional transformation

4.8 Looking into the future

4.8.1 Binding operator

4.8.2 Pipeline operator

4.9 Summary

5 Higher-kinded composition

5.1 Closing over data types

5.1.1 Using containers for encapsulation and immutability

5.1.2 Contextual composition

5.1.3 JavaScript data types

5.2 New Array APIs: {flat, flatMap}

5.2.1 Array.prototype.flat

5.2.2 Array.prototype.flatMap

5.3 The *map/compose correspondence

5.4 Universal protocols

5.4.1 Functors

5.4.2 Monads

5.5 Kinds of Algebraic Data Types

5.5.1 Records

5.5.2 Choices

5.6 Implementing the Validation ADT

5.6.1 Modeling success and failure

5.6.2 Basic usage

5.6.3 Higher-kinded composition with Validation

5.6.4 Point-free coding with ADTs

5.6.5 Validating complex data structures

5.6.6 Third-party integration

5.7 Future ADT-inspired JavaScript proposals

5.7.1 Maybe and optional chaining

5.7.2 Try and throw expressions

5.7.3 Pattern matching

5.8 Summary

Part 3: Code as data

6 ECMAScript Modules

6.1 Past state of affairs

6.2 Module patterns

6.2.1 Object namespaces

6.2.2 Immediately-Invoked Function Expressions (IIFEs)

6.2.3 IIFE mixins

6.2.4 Factory functions

6.3 Static vs dynamic module systems

6.4 ECMAScript Modules basics

6.4.1 Path specifiers

6.4.2 Exporting

6.4.3 Importing

6.4.4 A new extension in town

6.5 Import patterns

6.5.1 Factory function

6.5.2 Builder API

6.6 Benefits of ESM

6.6.1 Dead code elimination and tree-shaking

6.6.2 Faster property lookups and checked variables

6.6.3 Type friendly

6.7 Segregated, orthogonal design using ESM

6.7.1 Segregated Architecture

6.7.2 Orthogonal Architecture

6.7.3 A segregated, orthogonal architecture

6.8 Summary

7 Hooked on metaprogramming

7.1 Common uses of metaprogramming in JavaScript

7.2 JavaScript Symbols

7.3 Symbol registries

7.3.1 Local registry

7.3.2 Global registry

7.4 Practical application of symbols

7.4.1 Control switches

7.4.2 Serialization

7.5 Well-known symbols

7.5.1 @@toStringTag

7.5.2 @@isConcatSpreadable

7.5.3 @@species

7.5.4 @@toPrimitive

7.5.5 @@iterator

7.6 Dynamic introspection and weaving

7.6.1 Proxy objects

7.6.2 The Reflect API

7.6.3 Additional use cases

7.7 Emulating Aspect-Oriented Programming

7.8 Summary

Part 4 Scalable software

8 Linear async flows

8.1 Architecture at a glance

8.2 JavaScript as promised

8.2.1 Principle of non-locality

8.2.2 Are promises algebraic?

8.2.3 Fluent chaining

8.2.4 Promises in the wild

8.3 API review: promise combinators

8.3.1 Promise.all

8.3.2 Promise.race

8.3.3 Promise.allSettled

8.3.4 Promise.any

8.4 Async made easy with async/await

8.5 Async iteration

8.6 Top-level await

8.7 Summary

9 Native data protocols

9.1 Iterables and Iterators

9.1.1 Iterable protocol

9.1.2 Iterator protocol

9.1.3 Examples

9.2 Generators

9.2.1 To return or to yield

9.2.2 Creating iterable objects

9.2.3 Async generators

9.3 Working with data streams

9.3.1 What is a stream?

9.3.2 Implementing a stream-able array

9.4 Welcoming a new native: Observable

9.4.1 What is an observable?

9.4.2 The Observable protocol

9.4.3 Creating custom observables

9.4.4 Building your own reactive toolkit

9.4.5 Observable mixin extension

9.4.6 Representing push streams using generators

9.4.7 Pipeable operators

9.4.8 “Streamifying” objects

9.4.9 Dynamic streamification

9.5 Summary

10 Just enough typed JavaScript<A>

10.1 First off, what?

10.2 Benefits/drawbacks of using statically-typed JavaScript

10.3 Type annotations

10.3.1 Class types

10.3.2 Interface types

10.3.3 Object types

10.3.4 Function types

10.3.5 Generic types

10.3.6 Union types

10.4 Closing thoughts

10.5 Summary


Appendix A: JavaScript transpiling

Appendix B: Other TC39 proposals on the radar

What's inside

  • JavaScript’s objects and module system
  • Working with higher order functions
  • Driving application business logic with functional programming principles
  • Dynamically hooking into data with Proxy and Reflect APIs
  • Taming complex asynchronous behavior using reactive programming
  • Static type-checking with Flow
  • A hands-on peer-to-peer event driven system project
  • Future JavaScript proposals coming down the pike

About the reader

Perfect for intermediate JavaScript developers with basic familiarity with HTTP, HTML/CSS, and Git/CLI.

About the author

Luis Atencio is a software engineer for Citrix Systems, where he develops and architects web applications leveraging Java, PHP, and JavaScript platforms. He blogs about software engineering at, has spoken in many dev conferences, and has written articles for PHPArch magazine and DZone Refcardz. Luis is the author of Manning’s Functional Programming in JavaScript and the co-author of Manning’s RxJS in Action.

placing your order...

Don't refresh or navigate away from the page.
Manning Early Access Program (MEAP) Read chapters as they are written, get the finished eBook as soon as it’s ready, and receive the pBook long before it's in bookstores.
print book $29.99 $39.99 pBook + eBook + liveBook
Additional shipping charges may apply
The Joy of JavaScript (print book) added to cart
continue shopping
go to cart

eBook $23.99 $31.99 3 formats + liveBook
The Joy of JavaScript (eBook) added to cart
continue shopping
go to cart

Prices displayed in rupees will be charged in USD when you check out.
customers also reading

This book 1-hop 2-hops 3-hops

FREE domestic shipping on three or more pBooks