Eloquent JavaScript -Book Review (JavaScript)

Eloquent JavaScript (Marijn Haverbeke) from No Starch Press

I have been given the opportunity to review “Eloquent JavaScript” (3rd Edition) by Marijn Haverbeke, published by No Starch Press. First in the interest of fairness and openness;

No Starch Press has very kindly sent me a copy of the book for free.

As my regular readers may have noticed, I really enjoy the books that No Starch Press produce (check out my review of Impractical Python) and during summer 2018 I started brushing up on my JavaScript knowledge. So is Eloquent JavaScript a book that can help teach me JavaScript? and will it motivate me to use JavaScript more?

The first thing I’ve got to call attention to isn’t JavaScript but is the excellent Iain Banks quote from Player Of Games, part of the amazing Culture series: “All reality is a game”. A book quoting Banks gives me a positive impression straight away.

Marijn starts Eloquent JavaScript with a brief overview of computer programming, code and what JavaScript is. Marijn quickly points out that learning a programming language can at times be frustrating, whilst also noting that the reader needs to keep at it. In all honesty, I agree. Learning any programming language can take hard work, but when that hard work pays off it is a great feeling.

Marijn doesn’t shy away from the subjects that some JavaScript books skirt around; Eloquent JavaScript tackles functions, classes, data structures, objects, asynchronous programming (with discussion on the processor) and regular expressions in the first part of the three part book before letting the reader / learner know about the browser (part II) and Node (part III). Marijn uses several chapters to discuss theories (with exercises) before delving into a project that puts the theory into practice. This worked very well for me and I feel I will be returning to the book over and over to help with my JavaScript project ideas.

By part II of the book I felt that knowledge I already had around what I considered the basics of JavaScript had been reinforced and that I had learned so much more. Part II discusses the early days of JavaScript, the browser wars and how the Document Object Model (DOM) comes into play.

Eloquent JavaScript also discusses bug finding and performance; bringing to the reader/learners attention that not all programming languages are equal when it comes to speed. I was little shocked that find out that my favourite language (Python) could be compared to be 1 percent of the speed of C where modern JavaScript could be closer to 10 percent of the speed of C. Profiling, micro-optimisation and writing less garbage offer assistance in how to write more efficient code, with reasoning behind why code can be slow (e.g. how objects are stored in memory). However, one of my favourite lines was “The fastest way to do something is to avoid doing it – or at least part of it – at all.” as it points to unnecessary code.

The book has the familiar No Starch feeling of teaching lots of information mixed in with humour. This is what draws me to No Starch books, and Marijn continues the tradition. I particularly liked the exercise around a weresquirrel (poor Jacques the lycanthrope) and finding out if the transformation was caused by touching trees or eating pizza.

The book has an online sandbox to accompany it, allowing the reader to try out the exercise and code examples online. No Starch are currently (February 2019) offering Chapter 5 (Higher-Order Functions) for free on their website: https://nostarch.com/download/EloquentJavaScript3E_Ch5.pdf

To sum up, this is all the JavaScript knowledge you’ll need to hit the ground running in a JavaScript project and it’s a book I will be frequently revisiting as it has put JavaScript back on my radar.

Eloquent JavaScript (Marijn Haverbeke) from No Starch Press