A sample figure from Secrets of the JavaScript Ninja
The following diagram is from chapter 5, explaining how closures affect variable scope.
Figure 5.5 Hiding the variable inside the constructor keeps it invisible to the outer scope, but where it counts, the variable is alive and well inside the closure
The book is not for the complete novice. But I strongly feel that Part 2 of the book, which includes an in-depth coverage of functions, closures, prototypes, and regex, should be read by everyone who writes JavaScript.
Here's an excerpt from the front matter on that subject:
1.2.1 Audience
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.
No turtles. But an iguana did make its way into the text.
Bear Bibeault wrote:The book is not for the complete novice. But I strongly feel that Part 2 of the book, which includes an in-depth coverage of functions, closures, prototypes, and regex, should be read by everyone who writes JavaScript.
Sounds like a plan - I might as well aim a little high, anyway. Best of luck with the book!
chris webster wrote:
Sounds like a plan - I might as well aim a little high, anyway.
The nice thing about the way that book is structured, is that you can aim as high or low as you like by reading successive chapters and stopping when you've had enough.
As I said, Part 2* is accessible to just about anyone who has a basic knowledge of JavaScript. If you know what a for loop is, and can create and call a basic function, you can tackle part 2.
Part 3 is more advanced, but if you groked everything in part 2, you should be OK.
Part 4 is even more advanced. It's for those that really want to see how some of the esoteric things that libraries like jQuery and Prototype do are done.
You can stop when you think you've reached your personal zenith.
I think Part 2 is worth the cost of the book alone, and would benefit anyone writing JavaScript.
Best of luck with the book!
Thanks!
* The two chapters of Part 1 are just an intro, and a discussion about the state of debugging and testing tools. The only real "meat" is the development of an assert() function that we use throughout the rest of the book.
I have the MEAP but have not had a chance to take a look yet. At this rate I might get the paper copy before I get a chance to crack it open. I am looking forward to learning some things though
P.S. If you see this too late to act, if you wait until December 24th or 25th, you can try again. Manning will be running another sale then. I'll post the codes as the time approaches. (Or you can probably figure them out on your own if you look carefully at the code for today.)
Karim Kiswarday wrote:somebody knows if is possible to write on the the pdf version?
Do you mean with annotation tools like Acrobat or Preview? I would assume so, but I don't have a final copy yet.
The book is a MEAP version but I presume it's complete now.
It is! The print copies are being manufactured as we speak and should be in warehouses by the weekend. The eBook should be published during the coming week.
Wow, I found this book by looking at John Resig's "Javascript and jQuery" talk on youtube. I googled his book Pro Javascript Techniques and because that was written in 2006, I continued to google to see if he had written anything else. I eventually landed on Amazon.com where this book is being sold. However, amazon.com states deliver is 1 to 2 months! I then zoomed on the book cover graphic to see the publisher so I could google them. That's where I saw the Manning publisher and googled them. And I found the book listed, but only in PDF form. I continued to follow links until I landed here at CodeRanch.com! Now, I see that here on this forum there has been alerts of discounts and I missed BOTH of them! Plus, I see that a poster got his book on last Saturday! I can hardly wait for the epub to be available on Jan. 15! This may be a dumb question, but does "pbook" mean printed book?
After reading sample chapter 1, I am so glad to read where John writes: "If you're reading this book, you know that there's nothing simpe about creating effective and cross-browser JavaScript code. " Ain't it the truth! I write HTML and CSS and fell in love with Javascript from the beginning circa 1999, however, back then applets were being used more often, then javascript kinda went under the radar and was kinda frowned upon by computer programmers. But a few years later, it resurfaced in the AJAX world web 2.0 and she was back in business! How I wished I could have learned the language back then, but there really wasn't much on the web for a self-learner like myself. I feel like I'm playing "catch up" because javascript "resurfaced" with such a bang and hasn't stopped since! I've bought quite a few books on javascript and jquery, but this one really excites me! For those of us who may not be able to afford to go back to school and get a CS degree, I'm hoping this book will really provide a solid understanding through reading. I truly believe that javascript needs to be learned as a programming language just like java or c#, it shouldn't be taken lightly. Thanks Bear for your post here "Important Info" that gives us a sneak peek into chapters of the book, why it was written and what readers will learn.
Hi, I'm in the middle of the fourth chapter and so far I like the book very much. I have very little practice with JavaScript but a little with Java and I did finish two or three tutorials on JavaScript. I think you have a very good way of explaining concepts and underlying assumptions that other books gloss over. Thanks a lot!
Thanks for the feedback! That's exactly what we set out to do. Most other JavaScript books gloss over some important details, or present how to write JavaScript without explaining the why. We though that was important.
I also made sure that the informatioin was accessible to people coming to JavaScript from a Java background; there are a lot of us!
I cannot for the life of me find a place to properly submit errata for this book (which I'm thoroughly enjoying by the way!).
So I believe that page 161 has an error in the regex.
(parseFloat(filter.match(/opacity=([^)]+/)[1]) / 100) + "" :
The closing parans for the capture group should be inside the closing regex literal forward slash. For example, I've isolated just the pertinent part and in chrome console:
Congrats! That means you've read through a lot of difficult material and are still going! As the part opener for Master Training points out, it's not for the faint of heart. Good going.