JQuery vs Javascript

I’m currently working on the intermediate front end projects. I find myself using JQuery for most of my scripting needs. Anymore, it seems like I only use JavaScript for simple things like naming variables, creating loops, doing time delays, etc. Most of the heavy lifting in my code is done by JQuery. My question is: Is it worth learning how to do things in JavaScript if I can already accomplish them in JQuery?

1 Like

Short answer: Yes
Long answer: You are not going to always work on simple front end projects only in your professional life. There will be stuff/tasks that can be done more easily (or must require) using frameworks/libraries like React/AngularJs, Vuejs etc There maybe even times you need to implement your own utilities or JS plug-ins for your employer or needs. This means you must have good knowledge of JavaScript.
At the same time, as a web developer, our job is to provide right solution at right time using right technology, if you or your team feels JQuery is good for the specific task, use it. But again, to develop/debug any little advance applications or front end you will require good knowledge of JavaScript.

5 Likes

And of course, jquery means additional overhead, which is not always acceptable.

@mubaidr Makes Sense. So I guess it would be worth it to attempt some FreeCodeCamp projects using strictly JavaScript for the sake of practice then. Perhaps I might try to go back to my previous projects and translate all of the JQuery into Javascript. Thanks.

@lynxlynxlynx By overhead, do you mean computer resources? Is JQuery more resource demanding?

I’ve been forcing myself to use vanilla JS in my projects and haven’t found a need for jquery yet. Here’s a resource I found useful: https://github.com/oneuijs/You-Dont-Need-jQuery

JQuery is much more resource intensive. It can get clunky and slow when used for large projects and some companies avoid it for exactly that reason. The same chunk of code in pure Javascript can be exponentially faster.

@ksc23 Thanks. I’ll give this a read.

@Nicknyr Interesting. Didn’t realize JQuery was such a resource hog.

There are a lot of JQuery detractors. It’s become cool to come down on it.

Like many decisions in programming, there is a tradeoff to be made. JQuery is (arguably) easier to read and cleaner. But that comes at a price of bandwidth and speed.

Does it matter? Sometimes it will be hugely important, and sometimes it will be inconsequential.

As others have mentioned, it is important to learn both. JQuery is used on more than 70% of all websites, so you must learn it. But there will be times when you will need (because of needs of the app or prejudices of other programmers) you may need to not use it. So it’s good to eventually learn to do those things without JQ. But at this point, you don’t really need to learn that - it will come quickly later on.

1 Like

Some people get worried about jQuery’s “BIG” download size… which is 84K .min.js

but see no problems using Angular2 that has a 566K min.js size. :slight_smile:

3 Likes

On the other end of the spectrum Vue.js 2 is only 58.8K.

1 Like

I’m a big fan of Vue… also easier to use/understand than Angular.
Also JS + Vue + jQuery can work together just fine (just be aware of what not to do so as to not screw up model binding).