• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Learn the Secrets of the JavaScript Ninja!

 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
About Secrets of the JavaScript Ninja

[UPDATE] Secrets of the JavaScript Ninja was published in December of 2012. Hard-copy can be purchased from any book-seller including Amazon and the Manning site (see links below). E-book formats are available at the book's Manning page (also see link below).

A CodeRanch Book Promotion was held on the week of Dec 18, 2012.



John Resig

Bear Bibeault

Links for Secrets of the JavaScript Ninja

Inspect the Table of Contents for Secrets of the JavaScript Ninja

Visit the Manning (publisher) page for Secrets of the JavaScript Ninja

Buy Secrets of the JavaScript Ninja from Amazon.com or Amazon UK

Download the free sample code for Secrets of the JavaScript Ninja

Read the first chapter of Secrets of the JavaScript Ninja

Peruse John Resig's description of the book

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
 
Bartender
Posts: 2407
36
Scala Python Oracle Postgres Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Congrats!

But I'm more of a JavaScript Numpty, so will this book be far beyond my comprehension?

And will there be turtles?
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
chris webster
Bartender
Posts: 2407
36
Scala Python Oracle Postgres Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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!
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Update: the chapters have been through their first round of typesetting and I got to see them as they will appear in the print book and eBook! Cool!

 
Bartender
Posts: 1682
7
Android Mac OS X IntelliJ IDE Spring Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 466
1
IntelliJ IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Great, congratulations for the book. Wish it becomes a best seller. Look forward to it.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Manning is running a 50% off sale on all MEAP books today, including Secrets of the JavaScript Ninja.

So if you want to snatch up the Ninja book at a bargain, use code dotd1210au at checkout.

Today (Dec 10, 2012) only!
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.)

Also, you can learn more about Manning's Countdown to 2013 at http://deals.manningpublications.com/countdown2013.html, including how to get a shot at an iPad Mini!
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Secrets of the JavaScript Ninja will be the target of next week's book promotion here at CodeRanch.

Information on the book promotions
The book promotion schedule

The promotion itself will be conducted in the HTML, CSS and JavaScript forum.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The promotion now active in the HTML, CSS and JavaScript forum.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The cover that went to the printers:



 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Update: the book has been sent to the printer's and should find its way out of the bindery by Dec 28th.

The ebook should be available sometime next week.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Manning is offering half off of everything until Dec 25th at midnight (US Eastern Time, I assume). Use code celebrate50.
 
Ranch Hand
Posts: 50
Eclipse IDE PHP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
somebody knows if is possible to write on the the pdf version?

Can I write note on that or is it locked?

Thanks,
Karim

P.S.
The book is a MEAP version but I presume it's complete now.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Ranch Hand
Posts: 1087
Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
is it suitable for beginners
 
Ranch Hand
Posts: 247
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Vishal Hegde wrote:is it suitable for beginners



This has been already answered. Read this.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually, that question is answered here.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Look what I got in the mail yesterday!



 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Chris Disilva wrote:However, amazon.com states deliver is 1 to 2 months!


It's likely to be less than that. The print book is shipping from the bindery, so Amazon has either received inventory or is about to soon.

I just got 12 copies in the mail last week see above), so it does exist!

This may be a dumb question, but does "pbook" mean printed book?


Yup.

I truly believe that javascript needs to be learned as a programming language just like java or c#, it shouldn't be taken lightly.


Then I think you will like the book -- especially Part 2 which explains the fundamentals.

 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Finally! 5 weeks after being published, Amazon is finally shipping the book. Apparently, they were having "warehouse issues".



And today, it's the #1 book in the JavaScript and Java categories (despite not being a Java book -- go figure).

 
Rancher
Posts: 2759
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But,.. Javascript has Java in it!
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To be honest, I do mention Java a number of times in the book. Usually as the foil representing non-functional languages.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi tom.

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!
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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:

filter.match(/opacity=([^)]+/)[1] / 100
SyntaxError: Invalid regular expression: /opacity=([^)]+/: Unterminated group
filter.match(/opacity=([^)]+)/)[1] / 100
0.5

If I run the full code example in chrome the ternary will be bypassed. I would think this would throw an error in IE but I haven't tested.

P.S. Please advise where readers should post errata errors for the book ... thanks ;)
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Rob, thanks for the report.

That particular error has already been caught and is listed at the book's errata page (http://manning.com/resig/excerpt_errata.html).

You can report errata by posting in the HTML forum here, or by posting at the Manning book forum (http://www.manning-sandbox.com/forum.jspa?forumID=431).
 
Rob Levin
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Omg how did I miss that! Anyway thanks for a great book!!
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No problem, and thanks.

And welcome to the Ranch. Stick around for a while!
 
chris webster
Bartender
Posts: 2407
36
Scala Python Oracle Postgres Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My copy finally arrived from Amazon - whoo-hoo!

One day, I too will be able to snatch the pebble from the hand of the master....
 
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Right now ..I'm in Master Training
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
On June 7th (that's tomorrow at the time of this posting) Secrets of the JavaScript Ninja will be featured as Manning's Deal of the Day.

You can get the book for half off by using code dotd0607au at checkout.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
According to Amazon, my book is a choking hazard!

 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:According to Amazon, my book is a choking hazard!


But you'd have to agree that it isn't for children under 3!
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Indeed! Please do not feed a child my book!
 
reply
    Bookmark Topic Watch Topic
  • New Topic