You might also like: DOM Enlightenment
An O'Reilly edited version (printed, epub, mobi, pdf) of this book is now avaliable from O'Reilly or Amazon

JavaScript Enlightenment | by Cody Lindley | 1st Edition | ECMA-262, Edition 3

A book to turn a JavaScript library user into a JavaScript developer

Free PDF book (142 pages)

Free PDF (pre-O'Reilly updates) Download

This book is not about JavaScript design patterns or implementing an object-oriented paradigm with JavaScript code. It was not written to distinguish the good features of the JavaScript language from the bad. It is not meant to be a complete reference guide. It is not targeted at people new to programming or those completely new to JavaScript. Nor is this a cookbook of JavaScript recipes. Those books have been written.

It was my intention to write a book to give the reader an accurate JavaScript worldview through an examination of native JavaScript objects and supporting nuances: complex values, primitive values, scope, inheritance, the head object, etc. I intend this book to be a short and digestible summary of the ECMA-262, Edition 3 specification, focused on the nature of objects in JavaScript.

If you are a designer or developer who has only used JavaScript under the mantle of libraries (such as jQuery, Prototype, etc), it is my hope that the material in this book will transform you from a JavaScript library user into a JavaScript developer.

What people are saying

David Walsh ( says:
"Many authors write in a way to reinforce that they're the smartest guy in the room. What people like them don't understand is that eager-to-learn developers have already bought the book: they trust that you're the expert, so you don't have to use advanced verbiage to look intelligent. Cody skips that ego-centric exercise, explaining JavaScript concepts in Layman's terms." (source)

Michael Woloszynowicz ( says:
"JS Enlightenment does a good job of presenting often confusing concepts in a clear and simple manner that would make future reading more effective and increase the depth of learning. It achieves a good deal of its clarity through a copious use of well documented examples that are simple to understand but provide a great deal of insight into the language. For those already familiar with JavaScript, there's still a lot of value to be had from this book and will serve as an excellent reference if something should slip your mind." (source)

Aaron Gustafson ( says:
"Most of us old-timers learned JavaScript by reading other people's code and through blind experimentation, so we missed out on a lot of the fundamentals. In this book, Cody does an amazing job walking through the ECMA spec, detailing the intricacies of the JavaScript language. It made me love JavaScript even more than I already did." (source)

Mason Stewart says:
"Been meaning to say this for a while: @codylindley's JavaScript Enlightenment book is heavy-duty, next-level awesome. Definitely a 必殺攻撃!" (source)

Justin says:
"I read it and loved it! Your book is what finally got me to fully understand in inheritance, prototypes, constructor functions and object objects … whew! Thanks for writing it." (source)

Dan Wellman ( says:
"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." (source)

David Hayden ( says:
"It walks you from the very basics and along the way clearly points out parts of the language where most beginners will be confused, where there are seemingly inconsistencies in what you would expect, pitfalls to avoid, and techniques on how JavaScript Libraries often overcome glitches in the language." (source)

mark87dotcom from twitter says:
"JavaScript Enlightenment is so helpful for me. Thanks for writing a book about programming that I don't want to burn."

Alex Young ( from says:
"In fact, I really couldn't find anything missing. If you've ever wondered why JSLint is complaining about something, the root cause is likely to be explained somewhere in this book" ... "one of the most interesting books on JavaScript this year" (source)

Elijah Manor ( says:
"The book is able to fit in a ton of information in less than 150 pages! I highly recommend this book." (source)

Ben Nadel ( says:
"In short, Lindley finds just about every nook and cranny related to Objects in JavaScript and shines a light on it." (source)

Ryan Allen says:
"I bought this book when it came out, and I gotta say, it's the most thorough and pragmatic reference of JavaScript I've ever seen! Amazing! Great work!" (source)

Jeffery Way ( says:
"Its a breath of fresh air. I'm not aware of any other JavaScript books that focus exclusively on this subject. It's a nice way to drill the concepts into your head."

Michael P says:
"This isn't the mostly thorough JavaScript reference in existence, but it's pretty good. I view it as an alternative, condensed explanation of the material contained within books like JavaScript: The Good Parts, Eloquent JavaScript, JavaScript Design Patterns, and JavaScript: The Definitive Guide. My personal learning style requires that I synthesize an understanding of a complex topic by reading various texts on that topic, and I feel that, regarding the topic of JavaScript, JavaScript Enlightenment has a place alongside the aforementioned texts. Lindley really unpacks complicated topics in an almost conversational manner which makes the book, as a whole, easy to follow." (source)

Book excerpt

An excerpt from the book (chapter 6) can be found on as an article entitled, 'Fully Understanding the this Keyword'.

Why did I write this book?

First, I must admit that I wrote this book for myself. Truth be told, I crafted this material so I could drink my own Kool-Aid and always remember what it tastes like. In other words, I wanted a reference written in my own words used to jog my memory as needed. Additionally:

Who should read this book?

This book is targeted at two types of people. The first is an advanced beginner or intermediate JavaScript developer who wishes to solidify his or her understanding of the language through an in-depth look at JavaScript objects. The second type is JavaScript library veteran who is ready to look behind the curtain. This book is not ideal for newbies to programming, JavaScript libraries, or JavaScript itself.

Why JavaScript 1.5 & ECMA-262 Edition 3?

In this book, I focus on version 1.5 of JavaScript (equivalent to ECMA-262 Edition 3) because it is the most widely implemented version of JavaScript to date. The next version of this book will certainly be geared towards the up-and-coming ECMA-262 Edition 5.

About the author

Cody Lindley (website,twitter) is a client-side engineer (aka front-end developer) and recovering Flash developer. He has an extensive background working professionally (11+ years) with HTML, CSS, JavaScript, Flash, and client-side performance techniques as it pertains to web development. If he is not wielding client-side code he is likely toying with interface/interaction design or authoring material and speaking at various conferences. When not sitting in front of a computer, it's a sure bet he is hanging out with his wife & kids in Boise, Idaho, training for triathlons, skiing, mountain biking, road biking, alpine climbing, reading, watching movies, or debating the rational evidence for a Christian worldview. Currently he is working for TandemSeven as a Principal Front-End Architect.

About the Technical Editors

Michael Richardson is a web and application developer living in Boise, Idaho. Way back when, he got an MFA in creative writing from Sarah Lawrence and published a novel in 2003 called Plans for a Mushroom Radio. These days, when he's not spending quality time with his lovely wife and rascal kid, he's managing his little web-based application called Timeglider.

Kyle Simpson is a JavaScript Systems Architect from Austin, TX. He focuses on JavaScript, web performance optimization, and "middle-end" application architecture. If something can't be done in JavaScript or web stack technology, he's probably bored by it. He runs several open-source projects, including LABjs, HandlebarJS, and BikechainJS. Kyle works as a Software Engineer on the Development Tools team for Mozilla.

Nathan Smith (website) is a UX developer at Pure Charity. He holds a MDiv from Asbury Theological Seminary. He began building sites late last century and enjoys hand coding HTML, CSS, and JavaScript. He created the 960 Grid System, a design and CSS framework for sketching, designing, and coding page layouts. He also made Formalize, a JavaScript and CSS framework that endeavors to bring sanity to form styling.

Ben Nadel is the chief software engineer at Epicenter Consulting, a Manhattan-based web application development firm specializing in innovative custom software that transforms the way its clients do business. He is also an Adobe Community Professional as well as an Adobe Certified Professional in Advanced ColdFusion. In his spare time, he blogs extensively about all aspects of obsessively thorough web application development at

Ryan Florence (website) is a front-end web developer from Salt Lake City, Utah and has been creating websites since the early 90's. He is especially interested in creating experiences that are pleasing to both the end user and the developer inheriting the project. Ryan is active in the JavaScript community writing plugins, contributing to popular JavaScript libraries, speaking at conferences & meet-ups, and writing about it on the web. He currently works as a Senior Technical Consultant at Clock Four.

Nathan Logan (website) has been a professional web developer for 8 years.  His focus is on client-side technologies, but he also digs the server-side.  He currently works for Memolane, alongside the author of this book.  Personally, Nathan is blessed with a wonderful wife and son, and enjoys mountain biking, hot springs, spicy food, scotch, and Christian faith/theology.

Table of contents

Chapter 1 - JavaScript Objects
Chapter 2 - Working with Objects and Properties
Chapter 3 - Object()
Chapter 4 - Function()
Chapter 5 - The Head/Global Object
Chapter 6 - The this Keyword
Chapter 7 - Scope & Closures
Chapter 8 - Function Prototype Property
Chapter 9 - Array()
Chapter 10 - String()
Chapter 11 - Number()
Chapter 12 - Boolean()
Chapter 13 - Null
Chapter 14 - Undefined
Chapter 15 - Math Function