Beautiful JavaScript
Beautiful JavaScript

Editor:  Anton Kovalyov
Publisher: O'Reilly
ISBN: 978-1449370756
Kindle: B013VQ7N3G
Audience: Intermediate JavaScript Programmers
Rating: 4.5
Reviewer: Ian Elliot

Can JavaScript be beautiful? There are a lot of programmers who don't think so. 

This is a book that aims to get you thinking about JavaScript as more than a scripting language or simply a failed version of Java or C++. With the subtitle "Leading Programmers Explain How They Think", it is a collection of essays by different authors and each one treats their subject in a very different way. There is nothing uniform about this book and what each of the authors attempts to convey is idiosyncratic in content and style. 

The first essay is perhaps the toughest in the book if you are a JavaScript beginner. Beautiful Mixins attempts to explain a clever alternative approach to creating a mixin. The problem is that this first essay assumes a great deal of sophistication on the part of the reader as it discusses the philosophy and problems with JavaScript's prototype system. If you are not good at JavaScript you might well wonder what the discussion is all about. If you are then you will probably find yourself agreeing with the author. 

The next essay is about using eval for domain specific languages. The example is a template compiler. Eval is a difficult topic because it is generally regarded as a terrible thing - it stops JavaScript being optimized and it is a security risk. However it also happens to be a very powerful feature that only dynamic languages can easily provide. So it makes sense not to ignore it and to find out as much as you can about it. 

The third essay is the first of a number that are "fanciful". How to Draw a Bunny is a strange account of the range of expressions available to a JavaScript programmer. It argues that, while it might not be the best production code, clever idiomatic JavaScript might well be beautiful JavaScript. Of course, if you don't know enough JavaScript, you might not understand the examples.

The essays seem to fall into one of these two categories. Either the author has taken a specific aspect or task in JavaScript and used it to illustrate a wider point; or some philosophical point is illustrated by examples. For example, Too Much Rope takes the view that clarity is the most important part of coding and you should avoid the clever and perhaps beautiful ways of doing things. 




Next we have an essay on constructors and object factories - nothing new but the average JavaScript programmer will probably not have met the ideas before. One World, One Language is a strange little essay on the joys of JavaScript as an educational language - the one to teach. Just as strange is the inclusion of Math Expression Parser and Evaluator. It shows how to do simple language processing - lexer, parser and tree walker in JavaScript. Interesting but not really about the beauty of JavaScript. 

Evolution is an account of the use of frameworks - Backbone in particular and how this alters the way JavaScript is used. Next we have two tutorials, Error handling and The Node.js Event Loop. Again both interesting but not really about the beauty of JavaScript. 



The collection back on topic with the essay JavaScript Is, summed  up by - dynamic, static, functional, everything. Next, Coding Beyond Logic is very, very strange as it is a riff on the idea of a Quine - a program that when executed outputs itself. What this has to do with JavaScript in particular, or beauty?

The next two essays are much more what the entire book should be. JavaScript is Cutieful is a close examination of one line of idiomatic JavaScript code that will challenge your grip on the world:


This creates a 10 element array initialized to 0,1,2,3,,9. 

Now is this beautiful? 

I think you have to answer yes, but this isn't code you necessarily want to include in a production program - or is it?

The penultimate essay is a discussion of JavaScript as a functional language. Of course JavaScript isn't a hardline functional language and as such it gets criticism in this area as well as everything else. However, you might well write better code by taking a functional approach and try to enforce immutability as much as possible. 

The final essay, Progress, discusses the use of the ES6 class construct compared to alternative ways of doing the same job. This argues against the proposition that classical JavaScript is beautiful because it argues that JavaScript is more beautiful if we convert it into a different language - one that does inheritance. 

Overall this is a very mixed bag of essays. You do get the feeling that not everyone asked to contribute actually believes that JavaScript is a beautiful language. There is no coherent view or approach to explaining what makes JavaScript special. For me about four of the essays got it right, but you might well find that more or even fewer hit the spot. 

If you are, or on your way to becoming, a sophisticated JavaScript programmer you will probably find something to amuse or interest you. 


To keep up with our coverage of books for programmers, follow @bookwatchiprog on Twitter or subscribe to I Programmer's Books RSS feed for each day's new addition to Book Watch and for new reviews.

Related Reviews

JavaScript: The Good Parts

We have reviews of over 80 JavaScript titles and recommendations can be found in Building A JavaScript Library

Further Reading

Just JavaScript 

 There is a newer version of the draft of the book here.

A Radical Look At JavaScript


  1. JavaScript Isn't Java, or C, or C# ... (Book Only)
  2. In The Beginning Was The Object
  3. The Function Object
  4. How Functions Become Methods
  5. The Object Expression


Most books on JavaScript either compare it to the better known class based languages such as Java or C++ and even go on to show you how to make it look like the one of these.

Just JavaScript is an experiment in telling JavaScript's story "just as it is" without trying to apologise for its lack of class or some other feature. The broad features of the story are very clear but some of the small details may need working out along the way - hence the use of the term "experiment". Read on, but don't assume that you are just reading an account of Java, C++ or C# translated to JavaScript - you need to think about things in a new way. 

Just JavaScript is a radical look at the language without apologies. 



Algorithms in a Nutshell, 2nd Ed

Author: George Heineman, Gary Pollice, Stanley Selkow
Publisher: O'Reilly
Pages: 390
ISBN: 978-1491948927
Print: 1491948922
Kindle: B01DAWPK6S
Audience: Programmers wanting to catch up on algorithms
Rating: 5 
Reviewer: Mike James 

Over the festive season IProgrammer asks its revie [ ... ]

Machine Learning in Python

Author:  Michael Bowles 
Publisher: Wiley
Date: May 15, 2015
Pages: 360
ISBN: 978-1118961742
Print: 1118961749
Kindle: B00VOY1I98
Audience: Python programmers with data to analyze
Rating: 3.5
Reviewer:  Mike James 

Python is a good language to use to implement machine learning [ ... ]

More Reviews



Last Updated ( Tuesday, 23 February 2016 )

RSS feed of book reviews only
I Programmer Book Reviews
RSS feed of all content
I Programmer Book Reviews
Copyright © 2018 All Rights Reserved.
Joomla! is Free Software released under the GNU/GPL License.