Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vanilla javascript vs jquery [closed]

I am having trouble grasping the difference between the two. I tried downloading the library and there was no code. I am trying to build a basic slider along with other basic functions I have built in jQuery. Any help, tutorials, plugins and information would be very helpful!

like image 223
Jamie Avatar asked Jan 13 '13 22:01

Jamie


People also ask

Do companies use vanilla JavaScript?

5 companies reportedly use Vanilla. JS in their tech stacks, including HHEY, Picomto, and Labinator.

Is vanilla JS better?

You would be surprised but Vanilla js is extremely faster than other JavaScript frameworks. So you can say that it provides better performance than leading front-end frameworks.

Is jQuery still the best?

jQuery has been around for over 10 years, which is a long time for a code library. It's still one of the most popular JavaScript libraries in web development.


1 Answers

"Vanilla JS" refers to plain, unmodified JavaScript.

document.getElementById('myelement').innerHTML = "I was written with JavaScript!";

jQuery is a collection of functions and stuff that are intended to make it easier to write JavaScript (although personally I feel it makes it more like spaghetti)

$("#myelement").html("I was written with jQuery!");

Since jQuery is just a bunch of JavaScript, plain JavaScript is ALWAYS faster to run. It may be harder to write because you have to actually think about what you're doing, but it will run faster than the same thing in jQuery.

For a comparison of the two code samples above, see this JSPerf

like image 52
Niet the Dark Absol Avatar answered Oct 08 '22 09:10

Niet the Dark Absol