File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes Secrets of the JavaScript Ninja: important info from the preface Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Secrets of the JavaScript Ninja: important info from the preface" Watch "Secrets of the JavaScript Ninja: important info from the preface" New topic

Secrets of the JavaScript Ninja: important info from the preface

Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63873

To help answer questions that members have already asked (and such good questions, thanks!), as well as to anticipate some, I'm posting some important quotes from various pieces of the "front matter". I hope this helps people understand what the book is all about.

JavaScript is important. That wasn’t always so, but it’s true now.

Web applications are expected to give users a rich user interface experience, and without JavaScript, you might as well just be showing pictures of kittens. More than ever, web developers need to have a sound grasp of the language that brings life to web applications.

And like orange juice and breakfast, JavaScript isn’t just for browsers anymore. The language has knocked down the walls of the browser and is being used on the server in engines such as Rhino and V8, and using frameworks like Node.js.

Although this book is primarily focused on JavaScript for web applications, the fundamentals of the language presented in part 2 of this book are applicable across the board.

With more and more developers using JavaScript, it’s now more important than ever that they grasp the fundamentals of the language, so that they can become true ninjas of the language.


This is not your first JavaScript book. If you’re a complete novice to JavaScript, or you only understand a handful of statements by searching the web for code snippets, this is not the book for you. Yet.

This book is aimed at web developers who already have at least a basic grasp of JavaScript. You should understand the basic structure of JavaScript statements and how they work to create straightforward on-page scripts. You don’t need to be an advanced user of the language—that’s what this book is for—but you shouldn’t be a rank novice.

You should also have a working knowledge of HTML and CSS. Again, nothing too advanced, but you should know the basics of putting a web page together.

If you want some good prerequisite material, grab one of the popular books on JavaScript and web development, and then tackle this one. We can recommend JavaScript: The Definitive Guide by David Flanagan, JavaScript: The Good Parts by Douglas Crockford, and Head First JavaScript by Michael Morrison.

From the preface by John Resig

When I started writing Secrets of the JavaScript Ninja years ago, in early 2008, I saw a real need: there were no books providing in-depth coverage of the most important parts of the JavaScript language (functions, closures, and prototypes), nor were there any books that attempted to cover writing cross-browser code. Unfortunately, the situation has not improved much, which is surprising.

More and more development energy is being put into new technologies (such as the ones coming out of HTML5 or the new versions of ECMAScript). But there isn’t any point to diving into new technologies, or using the hottest libraries, if you don’t have a proper understanding of the fundamental characteristics of the JavaScript language. While the future for browser development is bright, the reality is that most develop- ment needs to make sure that code continues to work in the majority of browsers and for the majority of potential users.

Even though this book has been under development for a long time, thankfully it is not out of date. The book has been given a solid set of revisions by my coauthor Bear Bibeault. He’s gone through and made sure that the material will continue to be relevant for a long time to come.

... more ...

[Asking smart questions] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63873

From the Roadmap

This book is organized to take you from an apprentice to a ninja in four parts.

Part 1 introduces the topic, and introduces some tools we’ll need as we progress
through the rest of the book.

Part 2 focuses on JavaScript fundamentals; the kinds of things you might take for
granted but aren’t really sure about how they actually work. This part is likely the most important part of the book, and even if it’s all you read, you’ll come away with a much sounder understanding of JavaScript, the language.

In part 3, we dive into using the fundamentals that we learned in part 2 to solve knotty problems that the browsers throw at us.

Part 4 wraps up the book with a look at advanced topics focusing on lessons learned from the creation of advanced JavaScript libraries, such as jQuery.

Some particularly important passages:

Armed with these tools, chapter 3 begins our foray into the fundamentals of the language, starting, perhaps to your surprise, with a thorough examination of the function as defined by JavaScript. Although you might have expected the object to be the target of first focus, it’s a solid understanding of the function, and JavaScript as a functional language, that begins our transformation from run-of-the-mill JavaScript coders to JavaScript ninjas!

One of the most important concepts you can take away from this book is the subject of chapter 5: closures. A key concept in functional programming, closures allow us to exert fine-grained control over the scope of objects that we declare and create in our programs. The control of these scopes is the key factor to writing code worthy of a ninja. Even if you stop reading after this chapter (but we hope that you don't), you'll be a far better JavaScript developer than when you started.
It is sorta covered in the JavaRanch Style Guide.
subject: Secrets of the JavaScript Ninja: important info from the preface
jQuery in Action, 3rd edition