5 Useful JavaScript Books

image for '5 Useful JavaScript Books' post

Disclaimer: because of my affiliate relationships, you will make me money if you click on any of the book links below, then buy a book.

The good news is, there are a lot of JavaScript learning resources online. The bad news is, there are a lot of JavaScript learning resources online. Filtering the bad ones out from the good ones is hard.

This is why whenever I try to learn a new computer skill, I’ll buy a book about it first. Books go through rigid editing processes like fact checking and proofreading, all helping to filter out the bad content.

I have a lynda.com account so lately, I’ve used that as learning resource more than books. But JavaScript is the exception: a lot of great books have come out in the past few years, many of them “thinking books” that seemingly use theory when talking about JS.

Some books are better than others. I’ve read a lot of JavaScript books in the year before this article’s publish date. So as far as those books go, I’ve created a list of JS books which, I think, helps with the filtering process and lists only the best ones…so far. Here they are:

1. JavaScript: Visual QuickStart Guide (8th Edition) by Dori Smith & Tom Negrino

The best book for the JavaScript newbie. Every new edition migrates with the JavaScript trends: from image rollovers and cookie baking to DOM scripting to AJAX to object literals. The 8th addition keeps the tradition.

While the book does cover the trends, it also provides detailed step-by-step instructions on things that the JavaScript beginner needs to know: what a variable is, how to create an array, why are external JS files the right way to go, and so on. And it moves on from the basics to tutorials on more advanced topics such as reading data from a web server with AJAX and a few jQuery techniques. It ends with a great list of other learning resources in its “Where to Learn More” appendix.

If you know absolutely nothing about JavaScript and you pick this book up, I suggest that you treat it like a textbook. It covers JavaScript in the broadest sense, explaining the “hows” and “whys” of the code samples.

Personally, I think Visual QuickStart Guide should spend a bit more time covering the things that make JavaScript act more like an object-oriented programming language. One of its tutorials does mentions JSON, but not in great detail. Its object chapter does cover advance DOM manipulation techniques like cloneNode(), but aside from the object literal, there no mention of design patterns.

A beginner’s JS book doesn’t need to cover every single thing about objects, but should leave the reader with a basic understanding of JavaScript’s OOP potential. The book doesn’t fail at this, but doesn’t exactly hit a home run here.

Regardless of its limited coverage of JavaScript’s OOP possibilities, Visual QuickStart Guide is still the first book I recommend to someone who wants to learn JavaScript, but knows absolutely nothing about it.

2. Object-Oriented JavaScript by Stoyan Stefanov

Embellishing a bit more, Yahoo developer Stefanov does an awesome job of teaching the reader how to treat JavaScript as a full-on object-oriented language. He also does an awesome job of explaining the “hows” and “whys” job of the code exercises.

OOJ does cover JavaScript basics like variables and arrays, but not as in-depth as Visual QuickStart Guide. And it doesn’t matter because every topic he discusses, inheritance, closures, prototypes, getters, setters-all of it is useful in today’s JavaScript environment and are discussed in-depth.

A few things: OOJ was published by Packt Publishing who is notorious for releasing books with grammatical and spelling errors-this book is no exception. If you buy it, go to Packt’s Support page, click on the “Title” drop-down menu and find the book title: you’ll see the errors.

Also, Stefanov is working on the 2nd Edition of this book. He’ll be tackling ECMAScript5 and will have a new chapter on JS testing and documentation.

Despite the spelling errors and imminent updated version, any beginning developer with a little-better-than basic understanding of JS has to read the first edition of Object-Oriented JavaScript. That’s it…no more, no less.

3. JavaScript Patterns by Stoyan Stefanov

Another Stoyan Stefanov book, this one explains some excellent best practices such as the right way to structure for loops, when to use hasOwnProperty, and yes, proper JavaScript patterns. Stefanov did apply a few of these best practices in his OOJ coding samples but in Patterns, he explains the meaning behind them.

This book also drives home the importance of keeping the global space as clean as possible. Stefanov’s tips on namespacing patterns, inheritance and encapsulation are must-learns.

This is not a book for beginners and the author says so in the Preface. Except for the first two chapters, reading this book without frustration requires an intermediate understanding of JavaScript, particularly objects.

4. JavaScript: The Good Parts by Douglas Crockford

This article is slightly implying that Object-Oriented JavaScript is the best JavaScript book, which is subjective to other’s opinions. But no one can deny that JavaScript: The Good Parts is the most important book.

Written by Douglas Crockford, the creator of JSON who also works at Yahoo, this book has had tremendous influence on the JavaScript community since it’s 2008 publication. Dig thru the core files of jQuery and Modernizr and you’ll see that they’re chocked full of best practices mentioned in the The Good Parts or, as many refer to it, “the Crockford Book.”

Many, many things that you first learn in JavaScript will need to be unlearned after reading The Good Parts. Iterators, the new keyword, switch/case statements…be prepared to throw some of these away.

As with JavaScript Patterns, the Crockford book is not for beginners…REALLY not for beginners. Those that can’t do anything dynamic with JS outside of making a few alerts will find this book a tough read.

5. Pro JavaScript Techniques by John Resig

I’ll be completely upfront here: I’ve read most of this book, but not all of it. Plus, I haven’t implemented a lot of the new stuff I learned from it.

But this first book by jQuery creator John Resig stands out because it takes key JavaScript concepts, like AJAX and DOM manipulation, and expands on them with step-by-step exercises. It also covers JavaScript testing which is Resig’s most underrated skill.

Techniques isn’t as difficult a read as JavaScript Patterns or the Crockford book, but it won’t explain what a variable is like Visual QuickStart Guide will. But the fact that it offers detailed tutorials on important JS stuff makes it a must-read.

A suggestion on how to read these books

If you understand variables, arrays, functions, try/catch statements and for loops in JavaScript, you MIGHT want to skip Visual QuickStart Guide and go straight to Object-Oriented JavaScript. And as mentioned above, some of the best practices discussed in both JavaScript Patterns and the Crockford Book are discussed in the OOJ book, but none of the others.

To be honest, I suggest that you read Patterns and The Good Parts in parallel with the first two books. For example: when you start to read about for loops in Visual QuickStart Guide, take a few minutes and see what both Patterns and the Crockford book say about them. This is a pain, but the sooner you learn these best practices, the better.

After all this, go back and read Patterns and the Crockford book in full.

Happy reading!

Would you like to Tweet this page?