

Ask HN: Learning Javascript & AJAX - bgnm2000

Hey Everyone,<p>I've taken a class in javascript before, and I've been using mootools and JQuery for awhile - but I haven't really kept up with it enough to become a hand coder. Can anyone recommend any great books or online tutorials?
======
felixc
I'm going to recommend Douglas Crockford's "JavaScript: The Good Parts". It
will really show you how to get the most out of the language and avoid the
nasty pitfalls.

As a side note, I attended a talk by him last night on this topic, and wrote
up a summary. For a preview of the book, you may be interested in checking out
[http://www.felixcrux.com/posts/douglas-crockford-talk-
waterl...](http://www.felixcrux.com/posts/douglas-crockford-talk-waterloo/)

~~~
jdlegg
In addition to Douglas Crockford's book, which is excellent, I'd also
recommend the 2nd edition of "Professional Javascript for Web Developers" by
Nicholas Zakas.

------
invisible
I would honestly recommend reading through some of the code and trying to
figure out what it's doing. Find a function in jQuery you use all of the time
and figure out how it accomplishes it's goal. Also, John Resig has a decent
(albeit may miss some of the points you'll need) tutorial application:
<http://ejohn.org/apps/learn/>

(Edit: I'd also recommend any time you _need_ anything, look to see if it
exists first regardless of how small it is. And
<http://www.w3schools.com/jsref/> will help you enormously.)

As far as AJAX, I'd recommend to just understand how it SHOULD work.
Understand what the Xhrconn object you have should contain and what you should
be able to retrieve from the "raw" object if you need to do so. Trying to
understand where it fails in IE, Firefox, Safari, and Opera is overkill (there
are so many little bugs!).

------
tptacek
There's nothing wrong with continuing to use jQuery. In fact, there is
actually something wrong with "hand-coding" things for the sake of avoiding
jQuery. Spend your time where it will make a difference.

~~~
eam
What you're saying might be true, but some of us, like me, like to understand
what's under the hood. Learning javascript from scratch, in my opinion, is a
great way to fully take advantage of what javascript has to offer.

~~~
camccann
The trick, with something like jQuery, is to learn enough to begin to
understand why you're lucky you didn't have to implement it yourself.

At that point you stop, thank the deity of your choice for the existence of
people who abstract away browser incompatibility so you don't have to worry
about it, and move on to something else.

~~~
mechanical_fish
Yep. Spend your self-education time on something more productive than
recataloging the bugs in Internet Explorer.

~~~
jackmoore
Well stated. You loose momentum in becoming a better programmer by getting
bogged down in trivia of no real consequence.

------
eam
I was in the same shoes as you were. I really enjoyed Javascript & AJAX 7th
ed. by Negrino & Smith. It's an easy read and has great examples. It nicely
builds up from simple javascript to DOM manipulation, JSON, AJAX, and ends
with a brief touch up on javascript frameworks.

As I was reading this book at the same time I set myself a goal to build a
simple implementation of Lightbox without using Jquery or any framework. As I
read more, the easier it became. So as you read, you might want to choose
something to construct to practice and fully understand what you're reading.

A great continuation for it was Pro Javascript Techniques by John Resig.

------
bgnm2000
I just wanted to add, that I don't plan to stop using JQuery or MooTools,

I want to understand javascript better, so my implementations of mootools and
JQuery tools could become more impressive.

------
gtani
<http://fecklessmind.com/2009/02/09/top-5-javascript-books/>

[http://www.reddit.com/comments/6y1km/ask_reddit_good_javascr...](http://www.reddit.com/comments/6y1km/ask_reddit_good_javascript_books_what_do_you/)

[http://www.reddit.com/r/programming/comments/9gy1e/askproggi...](http://www.reddit.com/r/programming/comments/9gy1e/askproggit_whats_the_best_javascript_book_for_a/)

[http://www.reddit.com/r/programming/comments/8ptt5/ask_reddi...](http://www.reddit.com/r/programming/comments/8ptt5/ask_reddit_best_bookswebsites_to_teach_myself/)

usual suspects: Flanagan, "Good Parts" and Crockford's Videos, Resig,
Harmes/Diaz...

------
furtivefelon
I will recommend the book i'm currently reading: Secrets of the Javascript
Ninja: <http://jsninja.com/>. It is written by Jquery author, and it shows you
basically how a framework like JQuery would be written. It is not a book for
the faint of hearts, very in depth treatment of various aspects of javascript,
such as functions/closures/timers/cross platform javascript development etc.
You probably need Wrox Professional Javascript for Web Developer (2009) to
brush up on the basics first. Happy coding!

------
samuraicatpizza
I rarely use anything other than O'Reilly's"JavaScript: The Definitive Guide,
Fifth Edition" (<http://oreilly.com/catalog/9780596101992/>). It may be a bit
advanced if you haven't done much programming before and is probably more of a
reference book, but it covers a ton of topics and has a lot of working
examples.

------
hackworth
Jeremy Keith's "Dom Scripting" is a pretty good guide for getting up to speed
with the basics of good JavaScript coding. If you want to transition to
something more advanced later, I'd suggest "Pro JavaScript Design Patterns" by
Dustin Diaz.

------
workhorse
I am a huge fan of JQuery.

I think the JQuery website provides a great resource for learning and using
it.

<http://docs.jquery.com/Main_Page>

------
keefe
I want to echo the sentiments of others regarding the value of continuing to
use those libraries. A lot of real world programming is about knowing when to
use libraries and which libraries to use.

~~~
bgnm2000
I felt that knowing javascript in an expert fashion would enable to do much
more amazing things with those libraries.

~~~
keefe
It sure would, I just don't think there's any reason to mess with low level
stuff like XMLHttpRequest objects. For javascript itself, this book is always
good : [http://www.amazon.com/JavaScript-Definitive-Guide-David-
Flan...](http://www.amazon.com/JavaScript-Definitive-Guide-David-
Flanagan/dp/0596101996/ref=sr_1_1?ie=UTF8&s=books&qid=1255795344&sr=8-1) If
you haven't seen O'Reilly's safari yet, that's quite a nice program if you are
still in school learning a variety of things.

------
known
I like <http://www.xul.fr/en/> tutorials.

