JavaScript or jQuery

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.

Category:
Articles
Tags:

Join the conversation! 29 Comments

    • This book is fantastic. I do recommend it, for sure.

      • Yeah I also like codeacademy.

        Anyway perhaps I should extend my answer.

        I strongly believe that anything should be started from the bottom to the top, this references sports, foreign languages, computer graphics, and programming.

        It’s extra important to have a strong base, for it gives you extra control over overlays and is the only way to become good at something.

        Noone ever has started from the top going down to the bottom and become successful. This is a part of our natural development :)

        • I think that’s an overly broad statement — that no one has ever started from the top going down and become successful. I would bet there are a great number of developers that didn’t know a lick of PHP before they started working with WordPress and have since grown to be quite successful.

          • Right, perhaps you’re right.

            Nonetheless I think that it’s impossible to achieve the top level without actually struggling around at the mere bottom.for a while.

            You have to learn the base, no matter how talented you are.

    • Disagree!! Real life use cases of JavaScript and jQuery are VERY incremental. For my first year working with jQuery I basically only had to know how to initialize a plugin. If people had told me I had to learn JavaScript first I would have ran for the hills. It’s very easy to build off that and learn as needed.

      • Well given my academic background where learning the base (as in JavaScript first) was the way to do it, and looking at the JavaScript work offers around the web – I’m pretty confident to say that if you want to be called a true programmer you have to know the basics. Have you ever seen any pure jQuery work offers?

        I guess this is quite natural, first you have to learn how to walk and then you go for a jogging trip.

  1. I often get this question too, and I’ve thought long and hard about it.

    I only have two reasons that I point people to learn vanilla javascript first:

    1) Generally jQuery tutorials/books/example code lead to really poorly architected javascript code. This isn’t to say that it’s jQuery’s fault, but I think the value of JS is being able to understand why things work the way they do. Having an understanding of the reserved word “this”, understanding anonymous functions (and why you don’t need dom.ready) and variable hoisting are all vanilla JS concepts one really needs to have to leverage the power of JS and in the end, jQuery. jQuery is a convenience tool for cross-browser consistency, and being such, I think it makes it something that should be learned after having a grasp of vanilla JS.

    2) Now that Javascript is becoming a growing language in the server-side, there’s a lot of power in being able to use a language that transcends server/client, and jQuery won’t help here. I think if people are going to start learning libraries first, it’d be better to learn something like Require or any AMD library.

    All that to say, not all situations fit one answer.

    Good right up Tom. :)

  2. JavaScript. No question about it. jQuery is just a library, remember that. You still have to write JavaScript even with jQuery and you WILL meet a jQuery bug at some point.

    Furthermore, if you start building medium to large JavaScript web applications, the “jQuery way” of doing things is absolutely terrible.

    it certainly isn’t a stop gap that will prevent you from getting things done.

    Certainly not. But you’ll surely become a below-average developer at best. Have you ever met a WordPress expert that is not very familiar with PHP?

  3. Should I learn Javascript or Underscore.js first?

  4. Learning jQuery before JavaScript is dangerous in a way and can make you become lazy or dependent upon it.

    Sure, you can rapidly develop things with a few libs and lines of code but when things go wrong, what do you do?

    Personally, learning JavaScript has made developing things easier and faster. Learning variable scopes, inbuilt methods and most importantly, objects and types of the language.

    Knowing how libraries work and what they make easier is more
    Important in the long haul than just learning how to use them. You make yourself a better programmer in the process.

    I will admit however, because of jQuery and libraries that make development easier, people have become more interested in the native language.

  5. Erm, editor, we have a grammar problem: “how to can pass functions are arguments”

    That aside, I’m currently learning jQuery on Codecademy and wondering why in the heck they didn’t teach me this first. I learned Javascript, then HTML/CSS. The result was that I was wondering all throughout the CSS lessons how to implement Javascript code on this thing, which Codecademy never mentioned. Boom. Enter jQuery. Now I’m seeing how it’s possible to implement Javascript on webpages.

    I say jQuery is the natural next step after HTML/CSS, and Javascript the natural step after that. With those four (or three and a half?) languages down, one should be able to create pretty solid webpages.

    • Erm, editor, we have a grammar problem: “how to can pass functions are arguments”

      Thank you, sir. Fixed :).

      The result was that I was wondering all throughout the CSS lessons how to implement Javascript code on this thing, which Codecademy never mentioned. Boom. Enter jQuery. Now I’m seeing how it’s possible to implement Javascript on webpages.

      That’s interesting – I’ve never used Code Academy, but I’ve had some friends who have used it, or who have looked into using it, but it’s interesting to hear from someone who’s gone through the lessons you have and have had that experience.

  6. I strongly feel that JavaScript is the backbone. One ought to know atleast the basics of JS in order to go for jQuery…i know that some might not agree to this but I feel that this practice should be followed.

  7. You’re comparing a framework with a language here, it’s not like assembler to C, that’s not a good comparison. When you write with jQuery you write JavaScript, plain and simple, I cannot see how you could use a framework based on a language you do not know? I suppose we are ignoring the fact that a lot of JavaScript involves accessing the browser DOM. The DOM is no more, no less an API that is accessed by JavaScript. JavaScript does not required the DOM, the DOM does not require JavaScript. So what’s my point? You can learn the language JavaScript without learning the DOM. This is important and the first thing to do; now learning the DOM is critical for browser development but whether you learn that over jQuery first should be the question being asked here. Basically jQuery wraps DOM access and makes it a lot easier and cross browser compatible; OK so it also offers a host of extensions (not DOM specific) that are useful in JavaScript too, but these are just like anyone building a library of string functions etc.

    The message is plain and simple, learn the language, full stop! Maybe forget the DOM, this is your choice. I don’t understand what is so difficult to grasp here, such bad advice from so many so-called experts in the field, shocking….

    • You’re comparing a framework with a language here, it’s not like assembler to C, that’s not a good comparison.

      This is true – a good point.

      When you write with jQuery you write JavaScript, plain and simple, I cannot see how you could use a framework based on a language you do not know?

      But people do it all of the time. They start with jQuery instead of vanilla JavaScript and are off. They’re able to do this because of the method chaining, the CSS selectors, and so on. They don’t have to know about prototypes, Objects, or any of that in order to use jQuery.

      This isn’t to say knowing that won’t make you better, but it’s not required to write jQuery-based code. That’s how people can write jQuery without knowing JavaScript.

      So what’s my point? You can learn the language JavaScript without learning the DOM. This is important and the first thing to do; now learning the DOM is critical for browser development but whether you learn that over jQuery first should be the question being asked here.

      No argument from me on this one, but that’s not the question that people ask so perhaps the point of education should exactly as you’ve mentioned – when people ask, we determine if they understand the DOM and then go from there.

      The message is plain and simple, learn the language, full stop! Maybe forget the DOM, this is your choice. I don’t understand what is so difficult to grasp here,

      I wouldn’t say “difficult,” I’d say it’s an honest question people ask in order to determine what they need to add to their skillset in order to be more effective at their job.

      That’s not to say that I don’t have a personal opinion on what should come first, but I also do think that there’s a level of priority that comes with it. It is possible to write jQuery with understanding of the DOM and CSS and some very, very basic JavaScript facilities (like functions and strings) without knowing the language. People do it all the time.

      But can you be as effective, or write as efficient code? :shrugs: I think that you can make a case that you can’t.

      such bad advice from so many so-called experts in the field, shocking….

      Meh, sometimes advice is given based on ignorance, sometimes is based on experience. The thing that leads people to their conclusion on the issue is going to be based on one of those two things.

      As long as the person is making a judgment call from experience then I think it’s worth listening to even if it does’t align without own opinions.

      At any rate, I appreciate the comment and sharing this – you make some good points!

      • Hi Tom,
        Thanks for your response to my comment. I suppose I should eat a little humble pie, you have presented some very good justifications for your post. I did come across very strong in my opinion and that is just what it is.

        I did forgot my 101 with coding and development in general. I forgot it’s always about the end result, getting the job done. This involves the tools you use, I hear so many arguments around which languages and frameworks are better, but the answer is what is the right tool for the job, which is going to get the job done quickly.

        If you talk about career, I do believe getting to grips with JavaScript at some point is essential, especially to separate yourself from the competition. I suppose it depends on whether you are trying to innovate. The framework argument is always interesting, and you can apply this to jQuery. Some people believe writing it RAW is better, in some respects its the best form of control, but it won’t make you the most productive.

        So the thing is, if productivity is core, and you need a simple point of entry then maybe learning jQuery first is best. This is certainly going to be the case if you are more of a designer than a coder, if your skills lie in HTML, CSS then jQuery may not be a bad move. Of-course it is not the only framework, but the best (IMO) at the moment ;)

  8. Hey Tom,
    This was a nice post to read. I was embarking on learning jQuery first without getting the ins and outs of Javascript, but now, I think, I got the idea. Thanks again to you all.

  9. How are you going to work with Jquery without JavaScript knowledge ? Before study any js frameworks like angular, backbone, ember and so on – it’s necessary to learn javascript.

  10. Great article! I learned a small amount of PHP years ago and made a super basic CMS for a website that put horses up for sale (it actually worked). And the biggest problem I had was not learning the language as much as what to do with it and how to use PHP (or any language) in the best way. Both security and integration into my project. There are so many ways to approach each subject.
    I would do a project and then read something on the web that made me feel like the way I put it all together was basic crap. I guess, I have read a million tutorials starting with “Hello, World!” but could never really understand programming as it should be done? By the way don’t look at my old website as it is built with tables in Dreamweaver (I think even before Adobe bought out Macromedia) even using and image map for the navigation. 11 years ago OMG!!

  11. Thanks for inspiration, i this i must learn javascript and sometime learn jQuery.. because this is two ways for become expert :)

  12. Firstly, all that you are able to do with Jquery starts and stops with Javascript. What happens when you need to be able to do something that has simply not been covered yet by the Jquery library? You have one of two options. You either give up, or you learn to write your own Javascript, and if you are Savvy enough about it, you even use it to extend the Jquery library and put a notch on your belt and resume as a contributor to the Jquery project.

    The second main point has been mentioned already, but only once, so I’ll do it again. Learning Javascript also gives you a good foundation to step into server sided programming, instead of just front end work. Most people who are serious about their intent to work on websites will have this desire at some point, even if only to tinker and make their own database driven website. That being said Node.js is a server sided language that incorporates already known syntax if you already know Javascript, so it’s a win win.

    Summary: If you are only looking to do some quick and easy work, and are not set out on a goal to stand out, by all means stick to Jquery first. You can definitely be the best or “close” at copy cat cloning what you’ve already seen on the web. After all, that’s what Jquery is. It’s a library of Javascript functions that have been used so many times, someone wanted to make them easier. You can rest assured that what you are doing has already been done, and you’ll certainly break no astonishing ground.

    But, if you are the type of person who doesn’t mind the extra work that it takes to be innovative Javascript is what you need. If you are they type of person that doesn’t sit still once you’ve learned one aspect of your job, and you think you might want backend programming skills too, Javascript is for you.

    Jquery can do awesome things, but it can’t do “amazing” things. For something to be “truly amazing”, you have to have never seen it before. Otherwise, it’s awesome at best.

  13. Should I learn JavaScript or .js ?

    But there is no .js when i searched on godaddy it’s all .com nowadays but still .net sites available so .js or .net which will be better for beginners? because i heard microsoft’s .net is quite good, also the .net sites are available where as .js websites are not available at the moment., may be because it’s not fully server-side language yet.

    .Net is server programming so i can register a server with that domain.

    Please suggest me. I would also love to learn machine level language I am totally interested in computer language.

    Guys does anyone knows how to connect C++ to HTML because when i write html i do not compile and it gets printed on the browser without a black screen like C++.

    • Hey Louis,

      A lot of the questions that you’re asking deal with very diferent subject matter – some have to do with programming languages, others have to do with domain suffixes.

      Programming languages like JavaScript, any of the .NET languages, CSS, and so on use file extension that usually refer to those files (like .js, .net, .css, respectively). These are different than top-level domains which are things like .com, .net, .io, .es, .de, etc. There’s no relationship between the type of file that you’re writing or the language that you’re writing in that has any relationship to a domain.

      Secondly, the primarily machine language that programmers will start learning usually starts when Assembly then moves up to something like C.

      After that, “connecting C++ to HTML” is something that’s really unrelated to one another. C++ is a compiled language that will have it’s source converted into an executable binary by the machine on which it’s written and then can be distributed to other machines. HTML is a markup language that is parsed and displayed by the engine of a web browser. There’s really no relationship between writing C++ and having it execute within a browser.

      If anything, a browser could be written in C++.

      Hope this helps clarify some of these points.

  14. I am gonna try to answer this topic from amateur side.

    If you want to try to learn any programming skills, it seems like mountain. Thick books, complicated expressions… But last few years with some websites (codecademy, code.org etc.) its quite easy. Of course it depends to people wants but I think its all about motivation. People who wants to enter that information ocean, just take off your clothes, take a deep breath, and somehow try to swim.

    Focus your aim. If just jQuery is enough for your aim, than learn jQuery. After that maybe you will need some JavaScript skills, than you will try to learn JavaScript. A little more and a little more. Than its all gonna take shape in your mind.

    So I was thinking about that subject and finally i googled it. Anyway, there is good brain storm here.

    Thanks Tom!

  15. I started Rails and I had to stop to start Ruby from scratch. It was the way to go for me. I’m now starting with raw javascript too but it takes longer till you can actually do stuff, it cam be a bit frustrating.

    • I think this is one of those situations where it’s “to each his/her own.” I mean, I started with Prototype JS back in the day, then went to vanilla JavaScript, then went back to jQuery.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.