Vous voulez voir cette page en français ? Cliquez ici.

Sign in to turn on 1-Click ordering.
More Buying Choices
Have one to sell? Sell yours here
Tell the Publisher!
I'd like to read this book on Kindle

Don't have a Kindle? Get your Kindle here, or download a FREE Kindle Reading App.

Secrets of the JavaScript Ninja [Paperback]

John Resig , Bear Bibeault
5.0 out of 5 stars  See all reviews (2 customer reviews)
List Price: CDN$ 41.99
Price: CDN$ 25.07 & FREE Shipping. Details
You Save: CDN$ 16.92 (40%)
o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o
Usually ships within 3 to 5 weeks.
Ships from and sold by Amazon.ca. Gift-wrap available.

Book Description

Jan. 14 2013


Secrets of the Javascript Ninja takes you on a journey towards mastering modern JavaScript development in three phases: design, construction, and maintenance. Written for JavaScript developers with intermediate-level skills, this book will give you the knowledge you need to create a cross-browser JavaScript library from the ground up.

About this Book

You can't always attack software head-on. Sometimes you come at it sideways or sneak up from behind. You need to master an arsenal of tools and know every stealthy trick. You have to be a ninja.

Secrets of the JavaScript Ninja leads you down the pathway to JavaScript enlightenment. This unique book starts with key concepts, like the relationships between functions, objects, and closures, taught from the master's perspective. You'll grow from apprentice to ninja as you soak up fresh insights on the techniques you use every day and discover features and capabilities you never knew about. When you reach the final chapters, you'll be ready to code brilliant JavaScript applications and maybe even write your own libraries and frameworks.

You don't have to be a ninja to read this book—just be willing to become one. Are you ready?

Purchase of the print book comes with an offer of a free PDF, ePub, and Kindle eBook from Manning. Also available is all code from the book.

What's Inside

  • Functions, objects, closures, regular expressions, and more
  • Seeing applications and libraries from the right perspective
  • Dealing with the complexities of cross-browser development
  • Modern JavaScript design

About the Authors

John Resig is an acknowledged JavaScript authority and the creator of the jQuery library. Bear Bibeault is a web developer and coauthor of Ajax in Practice, Prototype and Scriptaculous in Action, and jQuery in Action from Manning.

Table of Contents

  1. Enter the ninja
  2. Arming with testing and debugging
  4. Functions are fundamental
  5. Wielding functions
  6. Closing in on closures
  7. Object-orientation with prototypes
  8. Wrangling regular expressions
  9. Taming threads and timers
  11. Ninja alchemy: runtime code evaluation
  12. With statements
  13. Developing cross-browser strategies
  14. Cutting through attributes, properties, and CSS
  16. Surviving events
  17. Manipulating the DOM
  18. CSS selector engines

Frequently Bought Together

Secrets of the JavaScript Ninja + JavaScript: The Good Parts + JavaScript Patterns
Price For All Three: CDN$ 63.62

Some of these items ship sooner than the others. Show details

  • Usually ships within 3 to 5 weeks.
    Ships from and sold by Amazon.ca.
    FREE Shipping. Details

  • JavaScript: The Good Parts CDN$ 18.80

    In Stock.
    Ships from and sold by Amazon.ca.
    FREE Shipping on orders over CDN$ CDN$ 25. Details

  • JavaScript Patterns CDN$ 19.75

    In Stock.
    Ships from and sold by Amazon.ca.
    FREE Shipping on orders over CDN$ CDN$ 25. Details

Customers Who Bought This Item Also Bought

Product Details

Product Description

About the Author

John Resig is the Dean of Open Source and head of JavaScript development at Khan Academy and the author of the book Pro JavaScript Techniques. He's also the creator and lead developer of the jQuery JavaScript library.

Bear Bibeault has been working in the area of web applications since the mid-nineties, getting started with beta versions of JSP and Servlets. He is a senior moderator at the popular JavaRanch site, and has contributed articles to the JavaRanch Journal as well as Dr Dobb's Journal online. He is a co-author of several Manning books including Ajax in Practice, Prototype and Scriptaculous in Action, jQuery in Action, and jQuery in Action, Second Edition. He works and resides in Austin, Texas.

Inside This Book (Learn More)
Browse Sample Pages
Front Cover | Copyright | Table of Contents | Excerpt | Index | Back Cover
Search inside this book:

Sell a Digital Version of This Book in the Kindle Store

If you are a publisher or author and hold the digital rights to a book, you can sell a digital version of it in our Kindle Store. Learn more

What Other Items Do Customers Buy After Viewing This Item?

Customer Reviews

4 star
3 star
2 star
1 star
5.0 out of 5 stars
5.0 out of 5 stars
Most helpful customer reviews
5.0 out of 5 stars Well written, expert-level knowledge Oct. 29 2013
Format:Paperback|Verified Purchase
This book was a long time in coming, and totally worth the wait! John really knows his stuff and gives some best practices and sneaky tricks to getting Javascript to do your bidding. If you're a pro JS developer, you should own this book, period.
Was this review helpful to you?
5.0 out of 5 stars Excellent reference June 5 2013
By Nathan
Format:Paperback|Verified Purchase
The testing section is a little bit out-dated but the rest translates very well. It's an excellent resource for understanding a language that is challenging at the best of times. It also reads quite well and has thorough and understandable examples.
Was this review helpful to you?
Most Helpful Customer Reviews on Amazon.com (beta)
Amazon.com: 4.7 out of 5 stars  55 reviews
39 of 41 people found the following review helpful
5.0 out of 5 stars Great book for any js coder Jan. 24 2013
By Smertrios - Published on Amazon.com
This book is a must-have for any serious js coder. It's almost guaranteed that you'll learn new tricks from this book. But more importantly your knowledge of the language will dramatically expand.

Bringing in a 'traditional' c/c++ background, js has been a 'pain' for me to deal with. I've been reading a few js books, tons of blogs and tuts, but very few expose the true nature of the language in a simple and pragmatic manner (way too many contrived examples out there, leading to greater confusion.) The kind of knowledge that keeps you from aiming at your foot... This book is it! I've been reading some of the chapters over and over to gain a deeper understanding of js. I then reviewed some of my previous code and realized that... shoot! I was gonna be limping soon.

Packed with information with an easy-read style, this book is already becoming a 'classic' for me. While not for beginners, if you're a programmer and learning js, I'd recommend you go through this book as you go. Most other js books focus on the syntax and usage but not so much on the language intricacies. For one, I tend to learn a language better if I also understand how it works.
60 of 66 people found the following review helpful
5.0 out of 5 stars Something to Recommend Other Than "The Good Parts" Every !@#$ing Time Book Recs are Asked For Feb. 25 2013
By Erik H. Reppen - Published on Amazon.com
Resig's earlier effort "Pro JavaScript Techniques" was a good read for its time but got spread thin by getting engrossed in the details of normalizing the DOM API which is something I already had quirksmode.org for as my go-to and that subject is now increasingly less complicated the closer you get to ditching IE8 support.

This is in my experience, the first book to really properly focus on all of the stuff that comes together to really make JavaScript unique and powerful as a language, which has in the past been an understanding you could really only come to by tinkering with JS and reading/borrowing from generous web contributions from Resig, (maybe) Crockford, and IMO, JS-superstar whose name is not sung enough (not for a lack of trying by Resig among others) Dean Edwards whose background in Scheme helped him help the rest of us understand JS for the true complexity-reducing and normalizing beast that it is.

JS didn't come out on top as the only client-side browser option worth pursuing by accident and the view-point that we're "stuck" with it is one that should hopefully be hastily remedied by reading about and understanding what a marvel JS really is when you stop blaming it for Microsoft's tomfoolery and get over the fact that Eich wrote the original version in ten days. That was 17 years ago. JS has evolved constantly since then and hasn't spread to the server, OS, and become the ultimate pan-mobile solution by accident either.

My general sense of the writing is that Resig as always is good at distilling the seemingly complex into bite sized pieces while Bear makes them go down much more easily.

On the "how to use this book" front I'd say keep browsing skimming David Flanagan's "Definitive Guide" to see what all your ingredients are but read this if you're interested in becoming a master chef. If you're intermediate level at JS or heavily experienced in another language to the point where you can compare its mechanics to other languages, this book's probably a good fit.

My only real gripe is (I assume) Resig's with-whiches, from-whiches and in-whiches, which I find semi-painful to read but this is a very minor thing.

Oh and it also took 'em long enough.

39 of 42 people found the following review helpful
5.0 out of 5 stars Excellent for becoming a javascript guru Feb. 4 2013
By Gary Bisaga - Published on Amazon.com
I know I'm mixing my ethnic metaphors, but this book will help you get to ninjahood, guruhood, or whatever other hood you desire to attain. I am not an inexperienced coder: I have 30 years of experience in coding, including 17 years of java and probably 5 doing semi-serious JavaScript. Still, this book opened my eyes to so many things about JavaScript. For example: I knew about functions and I knew about closures, but the exact relationship between functions, objects, and closures had always eluded me. Knowing what you are doing when you say "new Function()". So many other things.

Face it: most of us look at JavaScript as a toy language. But that is only because most of the scripts we've seen have been toy scripts. We've never really seen the guts of a serious JavaScript library like jQuery, require.js, or impactJS. Once you do, you start seeing constructs you can hardly fathom coming from a background in conventional programming languages like java. JavaScript is a serious programming language, and one that is deceptively similar in syntax to java, even though it could hardly be further in semantics. Add to that the fact that there are libraries that make JavaScript look object-oriented, you can easily transport your object-oriented lines of thought into your JavaScript programming.

This book really gives you the ins and outs of JavaScript. Within a few pages I was either learning things I had never known about the language, or realizing how things I had seen actually work. What's more, it presents it in a "unit test" environment. I had always doubted how testable JavaScript was, and I must not be alone, because the book starts out talking about unit tests and presents many of the features using a unit test environment to show how they really work. I consider anything that gets us to write more automated tests - and I am as guilty as any - a good thing.

I highly recommend this book.
24 of 26 people found the following review helpful
5.0 out of 5 stars It has the best explanation of Javscript closures I have read yet! March 25 2013
By S. Tang - Published on Amazon.com
I'll revise my review after I read more of this book, but I jumped right to the chapter on closures (Chapter 5.1) after I saw it in the table of contents.

I have never been satisfied with any definition on the internet or in Javascript books I have previously read. You can search for "Javascript closures" on the internet or at Stack Overflow and find (literally) dozens of explanations. I suppose the really smart coders can understand these explanations, but I found all of them to be unsatisfactory. All of them either had either abstract examples or explanations that never quite resonated with my meager mind.

This book nails it with an explanation that is actually straightforward and uses a simple code example (i.e. an outer function, an inner function, and some local and global variables; no arrays, no objects, etc.). The code example uses "hand-drawn" numbered callouts to explain important aspects of the code. I actually find these callouts superior to code comments, since the callout can "point" or "group" lines of code with an explanation and not be restricted by the format of a code comment.

For me, this chapter alone is worth the purchase price. Why? Javascript closures are apparently a popular interview question in some places, so understanding this topic is vital in more ways than one.
12 of 13 people found the following review helpful
4.0 out of 5 stars Good book on Javascript, but not great Sept. 11 2013
By Ulas Tuerkmen - Published on Amazon.com
Let me put it as mildly as possible: I don't like Javascript. I think
it's an ugly language with all the wrong choices, and too few
facilities to do decent development. I find it a pity that we're stuck
with it. Despite being a web developer, I have been concentrating on
the backend, and neglected Javascript until now. I picked this book to
remedy this neglect, and to see how the features of the libraries I
used everyday were implemented. Both expectations got satisfied, the
second one in a manner other than I expected.

Secrets of the Javascript Ninja does an extremely good job of teaching
the fundamentals of Javascript the language. It omits the stuff you
would just google, like how to split a string or get a random number,
instead focusing on the fundamental aspects that are different from
other imperative languages. The role of functions and closures are
explained in three detailed chapters. These chapters discuss the many
intricate details of how functions are created and used, and the many
roles they have to take on since Javascript has functions and not much
else. There are also some very interesting coding examples that could
be useful in other languages too, such as a very simple way to
overload a class method in five lines of code.

After the chapters on functions, the object-oriented facilities of
Javascript are discussed. Thanks to this chapter, I at last understand
the role of prototypes in Javascript. There is a pattern in the rest
of the book that starts in the object orientation chapter, though:
Since Javascript does not have most of the facilities that many other
languages (and environments, for that matter) have (such as proper
inheritance), the authors dive into implementing these in
Javascript. These attempts lead to very interesting code listings
which are sometimes really difficult to parse, and sometimes contain,
to put it nicely, surprising snippets of code, such as parsing the
code of a function with regular expressions to see whether it contains
certain references. The following two chapters, one on regular
expressions and the other on timers, contain a lot of very useful
background information, and practical tips and tricks.

The rest of the book, though, is a bit on the difficult-to-read
side. The topics are either not really practical because they concern
deprecated features (the 'with' statement has its own chapter), or
explain in detail how to build a parallel implementation of browser
features. These parallel implementations have one single reason:
IE. Every other section in the second half of Secrets of the
Javascript Ninja starts with "And then there is IE", before explaining
how to build a custom event-handler, CSS selector, or DOM
manipulator. Other browsers also have bugs and errors, but IE appears
to be a prick out of principle, not implementing central APIs, naming
attributes and methods differently, and simply being buggy as
hell. The sections on these parallel implementaions and
bug-circumventions made me happy that I can just drop in jQuery, and
ignore the ugly details.

Despite solid content on the language itself, I think Secrets of the
Javascript Ninja would have been better if the chapters on tricking
out the platform were a bit more limited on detail, and the
programming techniques themselves were given more weight.
Nevertheless, this is a great book for getting to grips with the
language that is, unfortunately, the most widely used of all
programming languages.
Search Customer Reviews
Only search this product's reviews

Look for similar items by category