Periodically, I’m asked the question:

Should I learn JavaScript or jQuery first?

Last month, I wrote about my two favorite JavaScript books, and though I considered answering that question in the post, it seemed a bit off topic – at least that day.

So why not take the opportunity to cover it in a post of its own?

Is It JavaScript or jQuery First?

The truth is, three or four years ago, I would’ve said that you needed to learn JavaScript first. Hands-down. No questions. Always learn the foundation before moving on to the library or the framework.

But as time has passed, my stance has changed.

In short, I simply say that it’s up to you.

Learn JavaScript First

If you opt to learn JavaScript first, then you’re certainly going to have the foundational language covered, and you’re going to understand how jQuery is doing some of the stuff that it does by wrapping objects with the jQuery object, how it handles manipulating the DOM, and so on.

But learning JavaScript before jQuery (or any other JavaScript framework or library, for that matter) is no more a pre-requisite than learning:

  • Assembly before C or C++,
  • C before PHP or Ruby,
  • C++ before .NET,
  • Ruby before Rails
  • PHP before Zend Framework (or WordPress, for that matter)
  • …and so on

This is not to say there aren’t advantages to doing so, but it certainly isn’t a stop gap that will prevent you from getting things done.

Learn jQuery First

If you opt to learn jQuery first, then there are going to be things that you simply take for granted.

Sure, you’re going to learn how to easily manipulate the DOM, do so in a cross-browser way, easily iterate through arrays, collections, and so on; however, you won’t necessarily know much about prototypes, callbacks (or maybe you will if you’ve worked in other languages), how to pass functions are arguments (similar to C’s function pointers) and so on.

But how much of that is really required to be productive? I’d say that very little of it is essential because you have a solid set of documentation that shows you how to get stuff done.

For some, that’s the most important aspect.

Regardless, if you start with jQuery and then back into JavaScript, then there are going to be things that simply “click” into place because you’re going to understand what jQuery is actually doing.

But One is Better, Right?

Honestly, this is your call and I’d say that almost every developer is going to have his or her own stance on this topic, and I’m no different.

I think it depends.

If you’re one of those that’s driven by having a deep understanding of the underlying nature of the tools with which you’re working, then start with JavaScript; otherwise, you’ve nothing to lose with starting with jQuery and then working backwards into JavaScript.

I say it’s your call; others may say otherwise.