Book review: JavaScript Enlightenment by Cody Lindley

September 14, 2011

jsEnlightenment Book Cover

JavaScript Enlightenment, by Cody Lindley, is the follow-up to the excellent jQuery Enlightenment. Its aim is to give you a deeper understanding of how objects work in JavaScript, to the point where you can understand how your favourite library works, or even write your own library, turning library users into library developers.

The book makes quite clear that it is not a general guide to JavaScript in its entirety, or a book about coding patterns, and the author does an excellent job of keeping the book succinct and focused on the topic at hand. It is literally filled with code examples to reinforce the topic being discussed, and like jQuery Enlightenment before it, all of the examples are up on jsFiddle for you to play with.

The starts with a conceptual overview of what objects in JavaScript are and how they are created, and used. It also covers the object constructors that are built-in to JavaScript to store specific types of values, and how to create custom constructors used to create custom objects.
It quickly moves on to describe using object properties, creating Object() objects and working with functions. The functions chapter shows all the different ways in which functions can be defined and invoked. This is a particularly detailed chapter and covers advanced function topics including the call() and apply() methods, function hoisting, useful function properties such as callee, anonymous functions and self-invoking functions and recursion.

A short chapter on the head object is provided, which gives useful details on the window object found in web browsers, and then the book gets into the real fundamental issues. You get a chapter dedicated to the this keyword that covers how the value of this is determined, how its value can be controlled in nested functions and how it can be used within constructor functions.

Next is a chapter that focuses on scope and closures, and in my opinion is probably the most interesting chapter in the book. It goes into great detail about how scope in JavaScript works including details on scope chains and look-ups, how scope is determined and how scope causes closures. Although the section on closures is short, the explanation is very clear and the code example really clarifies the basic mechanism at work.

Following this is a chapter on the prototype chain, another extremely useful chapter that reveals how some of the fundamental aspects of JavaScript work. It goes into detail on how inheritance via the Function() prototype property works, how prototype chain look-ups work and why the prototype property is important.

The chapters after this point are kept quite short and look at a selection of native object constructors built into JavaScript such as Array(), String(), Number() and Boolean(), as well as primitives, null, undefined values and the Math singleton. The basic use of each of these objects and values are detailed, along with any available properties and methods.

There is also a review section at the end of the book which lists all of the key points to take away from each chapter, which serves as a great mini-refresher if you read the book over an extended period.


Overall this is an excellent learning tool for intermediate to advanced JavaScript developers and is definitely highly recommended by myself. It reads well, is clear and concise and highly instructive. The fact that the code examples are all up on jsFiddle is a great feature that invites you to play around with them and this in turn helps cement the lessons from each section in your mind.

I came away from the book feeling that I’d learned a lot, which is exactly what you want from a technical book such as this. The danger of self-teaching yourself a programming language is that there will inevitably be gaps in your knowledge that you simply aren’t aware of, which can mean that powerful features of the language are beyond your manipulation. This is the kind of book that you need in order to fill those gaps.

At just $15 for a copy I don’t think there are many JavaScripters out there that can afford not to buy this book. Visit to secure your copy.

Leave a Reply

My Books