Best way to learn JavaScript?

This post is more than 2 years old.

I got an email (a few weeks back - sorry - trying to keep up ;) from a developer who wants to use jQuery but doesn't really know JavaScript first. Having to learn how to walk before you run - I was curious as to what folks recommend for the best way to learn JavaScript? I'll list out a few options here and I'd love for my readers to comment on what they would recommend.

For me, I initially learned via documentation on Netscape's web site. That was back in 96 or so, but the developer network has come a long way since then. Oddly they list out the reference before the guide - I'd definitely start with the guide.

The other big help for me was the O'Reilly book JavaScript: The Definitive Guide. I have a few of the old editions on my bookshelf and will probably pick up this new 6th edition in PDF. You can find other good JavaScript-related ORA books as well.

Another book - although one that can at times be complex - is Object-Oriented JavaScript by Steven Stefanov. I reviewed that last year and made the point that it had quite a bit of good introductory material as well.

Another option are conferences. I had always assumed the jQuery conferences were for Ninjas only. (Ok, JavaScript Ninjas I mean.) And while the average technical level was quite high, the quality was excellent and I'd still recommend it for someone new. Just be prepared to take a lot of notes and ask questions. Of course, the excellent cfObjective that just ended also had multiple JavaScript sessions. I saw excellent ones from Ezra Parker and Elliot Sprehn that were both pretty darn enlightening.

Lastly - don't forget that all of this runs in a browser. If you've got a browser (and - um - you must) and a text editor that you have all the bare minimum tools you need. You may want to look at using Dreamweaver to help out - or the excellent Aptana editor as well.

Like most things - how you learn best is something you know. Books, online training, just playing, or a mix of all, figure out what works best for you and just make the time.

Raymond Camden's Picture

About Raymond Camden

Raymond is a senior developer evangelist for Adobe. He focuses on document services, JavaScript, and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA https://www.raymondcamden.com

Archived Comments

Comment 1 by Mike posted on 5/15/2011 at 3:09 PM

I too am one of those that is trying to jump into jQuery without know a lot about Javascript. I found the book Smashing jQuery very helpful along with just finding some examples and breaking them apart to see what's what.

Comment 2 by Bob Chesley posted on 5/15/2011 at 3:19 PM

My favorite JS book is Javascript: The Good Parts by Crockford.

Comment 3 by John Luke Mills posted on 5/15/2011 at 4:33 PM

There is also the excellent Firefox add-in Firebug. This debugger for JavaScript makes life so much better.

Comment 4 by Rich Hefter posted on 5/15/2011 at 5:32 PM

I do now some fundamentals of JS/DOM - but not much more than that. Do you think that's enough for a "JQuery for Beginners" book?

Comment 5 by Naveen posted on 5/15/2011 at 6:16 PM

This post from rey bango site might be useful too.

http://blog.reybango.com/20...

Comment 6 by Robert Zehnder posted on 5/15/2011 at 6:27 PM

I never got a book, but I Google the heck out of things. If you know what you want to accomplish there is more than likely a tutorial out there showing you how to do it or at least something similar. Once I started tweaking it to do what I wanted I would get a better understanding of what was happening under the hood.

Of course, I always learned by doing things. If you like reading I suppose a book could be the way to go.

Comment 7 by Eric DeLabar posted on 5/15/2011 at 8:52 PM

My personal favorite is John Resig's advanced JavaScript tutorial, assumes you know the syntax, covers a bunch of other good stuff: http://ejohn.org/apps/learn/

Comment 8 by Wil Genovese posted on 5/16/2011 at 12:54 AM

I've been using videos at Lynda.com for JS and JQuery.

Comment 9 by Drew Wells posted on 5/16/2011 at 6:42 AM

do jQuery first, getting people to understand event-driven programming is too complex so start with something that makes it stupid easy

Comment 10 by D. Simcik posted on 5/16/2011 at 7:13 AM

I actually *would* suggest studying OO JavaScript by Stefanov to get a good handle on things like closures, the prototype object, and constructors in JS. Crockford's JS:TGP is a great book, but I think it assumes a good amount of previous JS knowledge - it's rather succinct.

You can also get early access copies of Resig's Secret's of the JavaScript Ninja on Manning's website. O'Reilly's JavaScript Patterns book looks pretty good as well.

Comment 11 by D. Simcik posted on 5/16/2011 at 7:44 AM

If he wants a more tutorial style introduction to JavaScript, have him/her check out:

Eloquent JavaScript: A Modern Introduction to Programming

Comment 12 by Phillip Senn posted on 5/16/2011 at 9:25 AM

Crockford has a 6 hour video at
http://oreilly.com/catalog/...

Lynda.com has titles on JavaScript and jQuery.
http://www.lynda.com

Sitepoint did a video series that has now moved to:
https://learnable.com/cours...

Comment 13 by web_dev posted on 5/16/2011 at 12:34 PM

You may refer <a href="http://www.w3resource.com/j...">w3resource JavaScript Tutorial</a>. This has in depth lessons and ample of examples. They have a nice online practice editor too.

Comment 14 by Doug posted on 5/16/2011 at 6:45 PM

@Drew:

I disagree, it's better to learn what the underlying language is first before you dive into the simplified version. A programmer needs to be informed as to WHY jquery is a powerful library, not just to accept it because blogs say so.

Nothing drives me nuts more than seeing a webpage where my predecessor loaded a 20k file (jquery.js) for no other reason than to get an easy way to getElementById().

16 bytes versus 20,000ish.

Comment 15 by Phillip Senn posted on 5/16/2011 at 6:56 PM

Well, there's a progression...
For someone that's new to JavaScript, they should use $('#myID') and $('.myClassName').
If your site is so popular that you are starting to see degradation, then you may want to refactor.
I know that my sites never have that many users, so for me, I can't foresee ever using getElementById.
I just load jQuery from Google's CDN and consider it to be a part of the browser.

Comment 16 by Adrian J. Moreno posted on 5/16/2011 at 7:04 PM

Doug, I couldn't agree more. I actually found this in code under development and kicked it back to be fixed:

var x = jQuery('#foo').attr('id');
document.getElementById(x).value = '';

My favorite quote about jQuery goes something like this (can't recall the source): "jQuery is this great framework that turns bad JavaScript programmers into worse jQuery programmers."

You have to learn to Wax On and Wax Off before you can try to Crane Kick.

I'll second Javascript: The Good Parts by Crockford and Eloquent JavaScript (http://eloquentjavascript.n....

Comment 17 by Phillip Senn posted on 5/16/2011 at 8:58 PM

Adrian, what was your recommended solution to them mixing jQuery and native JavaScript?
My solution would be to change document.getElementById(x).value = ''; to $('#x').val('');
I would venture to guess that if you removed the use of jQuery in your example, it didn't mean that jQuery could be taken out of the program.
If the JavaScript part of a program is so small that you don't have any references to jQuery in it, then it's merely a proof-of-concept.
If it's of any size at all, you're using jQuery somewhere else in there.
And if it's a proof-of-concept, you should still be using jQuery anyway because that means that you're learning the language.
Perhaps using getElementById is too simplistic an example. Anyone that has seen the minefield that events are (different commands depending on which browser) knows that a library HAD to have been written.

Wax on, Wax off? jQuery is a Makita Electronic Polisher-Sander!

Comment 18 by Doug posted on 5/16/2011 at 9:14 PM

Phillip:

I'd hate to admit it, but you're right. There are fewer and fewer pages these days that I'm using that don't use a JavaScript library at all. Eventually I might as well just load jQuery or whatever on my whole site since the overhead is marginal.

Still part of me is worried that jQuery won't be around for ever (perish the thought!) and I'd hate to be wedded to one library when there are others available that may be better--such as Mootools. Better to know the underlying language so you can jump across different libraries as the situation requires. But it's probably not necessary for JS newbies.

Comment 19 by Adrian J. Moreno posted on 5/16/2011 at 10:34 PM

We've standardized on jQuery for the entire application. Until about 6 months ago, we only included the library when it was used on a page. I determined we were using it so often, there was no reason to not just load it all the time, so we did.

We told developers that ***if*** they knew how to do something with jQuery, they should. We have a LOT of old school document.formName.fieldName.value() going on and even worse, window.document . . .

In the case above, yes, all they needed to do was jQuery('#foo').val('');, but they didn't know that. They didn't know val(), they knew how to set a field value using the getElementById() method. They "just wanted to use jQuery" and there you go.

@Doug - I wouldn't worry about jQuery. Microsoft has included it as part of the .NET framework and Adobe is invested in it as well. Have you seen the integration with DreamWeaver? It's amazing.

Ray, correct me if I'm wrong, but at the recent jQuery Conference, they stated that ~44% of all sites are using jQuery. If you intend to be in web development right now, I think learning JavaScript first and jQuery second would greatly benefit anyone.

Comment 20 by Raymond Camden posted on 5/16/2011 at 10:35 PM

@Adrian: I don't remember the exact #, but it was pretty high (I'd consider anything over 25% as high).

Comment 21 by Edward - Florida SEO posted on 5/17/2011 at 5:24 AM

Though I'm partial to The Definitive Guide the latest version of the JavaScript Cookbook covers the basics really well ...

http://oreilly.com/catalog/...

Comment 22 by Doug posted on 5/17/2011 at 5:40 PM

This one is a funny graphic about how people foolishly depend on jQuery. I stand by my assertion that people need to use jQuery and JavaScript intelligently.

http://www.doxdesk.com/img/...

(And hopefully this comment won't get filtered this time.)

Comment 23 by Raymond Camden posted on 5/17/2011 at 5:45 PM

@Doug: That's awesome. :)

Comment 24 by MikeG posted on 5/17/2011 at 11:56 PM

The book I always recommend is QUE's Special edition, Using Javascript by McFedries - it is as entry level as I have seen and is full of example code. Easy to follow, easy to use and goes from variables to DHTML all in layman's terms - though I expect most folks will never need the DHTML stuff now that we have jQuery. ISBN: 0-7897-2576-2

Comment 25 by Phillip Senn posted on 5/18/2011 at 4:19 AM

It's about that bad! Crockford says to do this to add two numbers together: +a +(+b)