JQuery vs Javascript

JQuery vs Javascript
0.0 0

#1

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?


#2

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.


Javascript vs jquery
#3

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


#4

@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?


#5

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


#6

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.


#7

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

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


#8

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.


#10

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:


#11

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


#12

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).