Secrets of the JavaScript Ninja

Title: Secrets of the JavaScript Ninja
Author: John Resig & Bear Bibeault
Year: 2012
For: For intermediate JavaScript developers looking to master the language.

John Resig is often sited as one of the most influential developers in the JavaScript community. While the library he founded – the infamous and ubiquitous jQuery – is sometimes criticized as a crutch for new JS developer, it’s no over-statement to say that jQuery changed the face of both JavaScript and CSS standards. In Secrets of the JavaScript Ninja, Resig teams up with Bear Bibeault (co-author of jQuery in Action) to create a dense and thorough overview of JavaScript, its idiosyncrasies, best practices, and suggested patterns.

The Content

This book is heavy; not by weight or length (it’s just shy of 400 pages), but by the immense amount of information it provides. This book, more so than any I’ve read, is for the aspiring library developer and actually ends with a quarter of the book devoted to creating a core for a cross-browser, legacy compatible library. But even if you’re not looking to make the next jQuery/Underscore/lodash, this book takes you from intermediate level to master status.

Secrets of the JavaScript Ninja starts just after most “Intro to JS” books ends; JS Ninja assumes you already know fundamentals such as constructors, object literals, and iteration. The target audience will have already worked with JS in the DOM, even in rudimentary ways. This is a great relief if you’re tired of having function declarations explained to you. The book begins explaining some trickier concepts that might be daunting to advanced beginners: recursion, closures, prototyping, regular expressions, and synchronous vs asynchronous programming.

By the end of the first half of the book, you’re well on your way towards advanced JavaScript technique; this is where the authors quickly up the game and begin training for library development. eval() and with() are covered for the sake of thoroughness, cross-browser strategies are given a full chapter, and DOM manipulation comes into play. The book ends with three of the most challenging sections I have ever read: developing a cross-browser event handler, developing a set of DOM manipulation tools for a JS library, and creating an in-house CSS selector engine that’s compatible with legacy browsers (I believe all the way back to IE 6).

The Style

The book is in four sections, each capable of being an independent book: Preparing for Training (best practices and TDD), Apprentice Training (advanced language fundamentals), Ninja Training (working in the DOM, eval, and with), and Master Training (developing a core for a JS library). The book is full of code examples to illustrate key concepts and emphasizes test driven development. In fact the beginning of book starts with developing a personal test suite that’s used throughout the book to test code. This is great in that it is a strong hint towards best practices, but it also helps guide the user to understanding test writing for the DOM.

Just keep in mind though, this is a very dense book. I would recommend taking it section by section, letting the wisdom of these JavaScript ninjas fully sink in before moving on. I checked this book out twice before finishing it and still feel like I went through it too quickly because while the first two sections were pretty accessible, the last two really took a deep dive into territory that I’m a little unfamiliar with.


This is a great book and one that I will keep coming back to as I continue my own quest toward JavaScript mastery. It is written by two very influential developers in a way that is mostly accessible and relevant. I would not at all recommend this as a beginner JavaScript book, but really doubt that anyone could read this book without picking up some new tricks for the JavaScript arsenal.

Return Home