Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
What to Read to Get Up to Speed in JavaScript (reybango.com)
164 points by stsmytherie on Dec 17, 2010 | hide | past | favorite | 34 comments


My recommendations:

Videos:

* YUI Theater talks by Douglas Crockford: http://developer.yahoo.com/yui/theater/ especially:

* The JavaScript Programming Language

* Advanced JavaScript

Websites:

* "A Re-introduction to JavaScript": https://developer.mozilla.org/en/a_re-introduction_to_javasc...

* Advanced tutorial from John Resig: http://ejohn.org/apps/learn/

* MDC Reference: https://developer.mozilla.org/en/javascript

Books (you can borrow my copies of these if you want):

* "JavaScript: The Good Parts"

* "JavaScript: The Definitive Guide" is a good reference for both the language and browser/DOM APIs


"JavaScript: The Good Parts" by Crockford is excellent. It convinced me to minimize the use of JavaScript and thereby avoid the perils of the programming cutting edge (e.g., node.js). He also showed me how, in JavaScript, to add two numbers by calling a function that passes back another function that I can then call to add the numbers - just what I needed!8-))

But seriously, I used JavaScript with abandon years ago and found it laughable then. Crockford's book taught me that JavaScript hasn't changed much in the intervening years - still a hoot as a programming language. You can get just enough done with it if you stay minimal: try to do too much and you'll end up down the creek without a paddle.

FWIW here's a good article that discusses pros and cons of functional JavaScript. http://bolinfest.com/javascript/inheritance.php


I find The Definitive Guide is completely unnecessary with access to the internet.


It's not just a reference, the first portion of the book is good overview of the language and browser APIs.


I agree.

Plus, the book was available before we had all the different resources on the web. I read a few years and rarely refer to it anymore but I especially liked the parts on browser inconsistencies.(my edition is dated now, but served its purpose at the time i bought it)


The version I bought in 2008/9 was already bit outdated (the 5th edition?), and I agree - I haven't really used it very much. I've learned a lot more from the other resources tlrobinson suggests. I find the Flanagan book rather reminiscent of the JS state of the art, circa 2004. I don't think it places enough of an emphasis on understanding techniques like using closures and other methods of working with scope.


That list is way too long. JavaScript isn't that big or complicated, even if you include DOM and cross-browser issues (which by virtue of continuous browser changes, you will never learn about from a book).

My top 3: 1. Eloquent JavaScript 2. JavaScript the Good Parts 3. High Performance JavaScript (see my review: http://carcaddar.blogspot.com/2010/07/book-review-nicholas-c...)

Also, I wouldn't recommend either of Resig's books, despite not reading them. Look at Peter Michaux and David Mark's posts on comp.lang.javascript for criticisms (actually, comp.lang.javascript would be the fourth thing on my list if it was a book).


The posts about Resig that I can see by Peter Michaux and David Mark seem to be mostly empty of content and filled with petty namecalling. Do you have any specific review/critique that you think is helpful?

For what it’s worth, Secrets of the JS Ninjas is one of the most illuminating JavaScript resources I’ve seen anywhere – I don’t know anyone who wasn’t able to learn something from reading it, including skilled, seasoned JS developers, and several of its insights can’t be found anywhere else so far as I know – and it’s at this point still a half-written draft.


I can't find the criticisms of Resig's you mention. Can you provide a link?

I did find an encyclopedia's worth of ranting.

Conclusion: don't read Resig's books because two guys who spend a lot of time hating jQuery have criticised the books harshly somewhere on a gigantic website about javascript.

I don't buy that argument. Links please.


http://michaux.ca/

http://www.cinsoft.net/mylib.html

Both are experts on JavaScript and while David Mark is controversial, Peter Michaux is not. If he is hating jQuery (and he is not the only one, about 75% of that JSMentors list considers jQuery bad), that must be for a reason. Google for "browser sniffing" vs. "feature detection" to make your own opinion.


Here's David's c.l.j post that caused a lot of controversy:

http://groups.google.com/group/comp.lang.javascript/msg/37cb...;

If you want to see other criticisms for them, search c.l.j archives on Google Groups (I admit it's not easy ever since Google ruined Groups search).

The thing with jQuery is it's not as simple as "I hate jQuery." The basic idea behind jQuery (selectors) is a great way of doing stream processing over the DOM. This is a really convenient way of working with existing HTML pages.

The main reason David Mark dislikes jQuery is that (at least at the time) it was poorly implemented. Before I ever came across his posts, I tried reading jQuery code and thought it was very hard to understand, but bought the conventional wisdom excuse that JavaScript programming was special because of cross-browser hacks and people like Resig were "ninjas." Then I came across Michaux's code, read Mark's posts, and realized that the "JavaScript ninjas" were really just writing bad code.

But that doesn't change the fact that jQuery is very convenient to use for manipulating existing HTML pages. But there's another problem there - jQuery does stream processing eagerly at run-time. This is extremely inefficient, and there's no reason to do it for pages where you have control over HTML.

A lot of work has gone into caching in jQuery to avoid duplicated selector search, by far the biggest overhead (conceptually, you're doing an exhaustive search over the entire DOM every time you execute a selector).

But that still doesn't address the fact that the results of the selectors are produced eagerly, and processed by every operator eagerly. There are two optimizations that can be made here: map fusion and lazy evaluation. The latter is possible, but would require rewriting jQuery and changing its interface. The former is impossible without a preprocessing step.

But like I said, there's really no reason to even bother using jQuery with pages where you have control over your HTML and can put the objects you need into arrays and hash tables to be there when you need them. That, and the move of web applications to canvas (at this point I'm convinced it's inevitable) make jQuery irrelevant at this point in time IMO.


Those links go nowhere relevant.


Eloquent JavaScript has a print version coming out as well: http://nostarch.com/ejs.htm


For completeness, here is the interactive version: http://eloquentjavascript.net/contents.html


What if I had to Choose Just 3 Books

You selection is good but I can't believe that in the "if I could only get three" section, Crockford's the good parts is not #1. I mean it is the seminal work for JavaScript, it should be the first or second book anyone considering doing serious JavaScript should read.


I must echo this sentiment and also mention a few non-books that were instrumental for me.

For my new job (first out of college) I have read ~5 javascript books cover to cover and flipped through a few more.

Crockford's book was by far the most enlightening and made the most immediate impact on my understanding and methods of coding.

Second, for me, was John Resig's blog (http://ejohn.org/blog)

And third I suppose might be looking through the way people have written things on github:

https://github.com/nzakas

https://github.com/jquery/jquery


I will echo your echo, along with a JavaScript tutorial by Resig which I rate at least as highly as The Good Parts: http://ejohn.org/apps/learn/


The thing about Crockford's book is that it's short and direct, and gives you the straight dope on how you program in JavaScript. It would be a terrible book for someone first learning to program, but if you know a few programming languages already -- especially something that supports lexically-scoped anonymous functions -- then JS:tGP is something you can read through in an hour or two, and then just start writing JavaScript.


@kls: Thanks. Crockford's book is certainly good which is why it was part of the bigger list. For me personally, I much preferred the 3 books I listed because I've found more value to them.

Appreciate the feedback though and thank you for reading the post.


Try to separate the JavaScript language from the additional bindings that the platform gives to you.

If you learn client-side JavaScript for use inside the browsers, differentiate what's a language feature and what's part of the DOM.

If you learn server-side JavaScript, start by looking over the CommonJS standards as they tend to be the common denominator across the server-side JS implementations.

And... experiment. Write a .html on your desktop which references a sample.js and use your browser to check it out and modify the code. Don't rely on technical knowledge for more than a couple of hours without trying out the things in practice. Or, for server-side JavaScript, you can get a free hosting account and browser-based editor at http://erbix.com (+), using just OpenId (i.e. your Google account) to sign up.

(+) Disclaimer: I'm affiliated with Erbix.


Not a book and not a blog, but if you want to keep up with the latest JavaScript stuff on a weekly basis through e-mail: http://javascriptweekly.com/

Yes, it's mine but it's had kudos from folks like Steve Souders and Amy Hoy and almost at 3000 subscribers so I don't feel too bad pimping it. Latest issue is at http://javascriptweekly.com/archive/5.html if you want a preview.


Eh, in my opinion, unless you're doing server side javascript, the thing you need to learn most about when doing javascript is dhtml. The actual javascript language isn't the hard or strange part of the experince.

Most of his links seem to point to actual language esoterica. Only 1 seems to really point at DOM interactions.


I think people coming from most other languages that have objects get very confused about prototypal inheritance. The significance of first-class functions is also not obvious to people who don't come from a functional programming background.

I think you're right insofar as it's easy to "get going" with JS and see things happen in a web page. But if you're looking to actually learn how to build non-trivial apps, a solid grounding in the language is pretty key.


9 books worth of grounding?

I think one beginner and one advanced book maybe. True, I did come from a different background than most (having learned both those features in other languages before ever doing javascript), but do you really need 7 more books to tell you about it?

I think the post is bordering on book affiliate spam.


I don't disagree with you on that point. Two books should be plenty. I'm only pointing out that there's a lot of utility in learning about JS as a programming language, completely divorced from DOM stuff.


That's because DOM interactions are one of the least interesting aspects of Javascript and not where the current innovation is happening. JQuery has pretty much taken care of that. Buy a JQuery book for that.

The newer javascript frameworks - the ones that are driving interest in Javascript as a language - are flexing the language features to the point where having good books help. The javascript language is pretty hard and strange when you really start getting in there.


No where on the page does it discount the normal case (using Javascript as page display and animation language) and point out these are mostly for the server side/complicated framework people.


Shorter list from hn-books: http://www.hn-books.com#B0=41&B1=14&B2=89&B3=119...

Note that I included a JQuery book in there. Any more, it's not enough to know just Javascript, you should also know JQuery (and just as importantly you should know when to use it and when not to use it)

These are ordered, so the top 3 are the best (in my opinion). The others are really good, but with a topic like this it can easily spin out of control, with hundreds of books getting recommended. Stick to 2-4.


[deleted]


When studying a language, one does not typically start with an abstraction library.


"Javascript : The Good Parts" + visit http://ejohn.org/apps/learn


I wish there were more posts like this, explaining which books are suitable for each "knowledge level."

My biggest issue has always been that most books assume you know nothing about programming, and so become boring and repetitive, and I learn nothing new.


What about server side JavaScript? I guess there are no books yet?


I can't locate any. But as far as the language basics, they're the same, of course so Crockford's various works should go a long way.


None that I know of but the books I listed will teach you the JavaScript language itself which would carry over to SSJS.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: