Introduction: In this article
I am going to explain the difference between JavaScript and jQuery or we can
say Javascript vs jQuery. It is one of the most frequently asked interview
question.
In previous article on jQuery I explained Jquery to show image preview after validating image size and type before upload in asp.net and Dropdownlist with checkboxes using jquery bootstrap multi select plugin and Add textbox search functionality in asp.net checkboxlist using jquery and Jquery to move items from one listbox to another in asp.net and Jquery to validate file type and size before uploading through asp.net fileupload control
Let's see what are the difference between both one by one.
JQuery:
1) JQuery is basically library of JavaScript. But the
difference is that jQuery make the life of a developer easier because using jQuery
we can do more with less code. We can achieve the same result by writing less
line of code than JavaScript. We don’t
not to write much scripting which already exists in JQuery library.
2) All common functionalities needed while developing any
web application which requires many line of JavaScript code
are now grouped and made as a library called "jQuery".
3)jQuery has been optimized to perform many common
scripting functions in just fewer lines of code to make coding faster and
easier.
4) To be able to use the jQuery library in our project we need to either download jQuery
files from http://jQuery.com/download/ or
we can use Microsoft or Google CDN (Content Delivery Network) directly inside Head
tag as mention below:
Google CDN:
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jQuery/3.2.0/jQuery.min.js"></script>
</head>.
<script src="https://ajax.googleapis.com/ajax/libs/jQuery/3.2.0/jQuery.min.js"></script>
</head>.
Microsoft CDN:
<head>
<script src="https://ajax.aspnetcdn.com/ajax/jQuery/jQuery-3.2.0.min.js"></script>
</head>
<script src="https://ajax.aspnetcdn.com/ajax/jQuery/jQuery-3.2.0.min.js"></script>
</head>
5) The additional library that jQuery requires can dramatically increase loading time for those with slow internet.
6) jQuery simplifies some tedious tasks like manipulating
the DOM, HTML document traversing, event handling, adding some effects and
animations and most importantly doing it in a cross browser fashion. One of the
tasks that is simplified by jQuery is AJAX which is a concept allowing a
browser to send an asynchronous request to a web server allowing for richer web
applications.
7) The primary benefit of jQuery is the reduced
development time so it is good for simple projects with a tight deadline.
8) jQuery is less prone to make mistakes or miss
something than JavaScript .
9) jQuery is more beginner friendly than JavaScript.
JavaScript :
1) JavaScript is language whereas jQuery is library programmed in that language. It’s like "English" vs. "book written in English".
Or we can say JavaScript is an "egg" and jQuery is ready made "Omelette".
2) Either option can be used to do the exact same task, but often jQuery can do it
with fewer lines of code.
3) Biggest difference between jQuery and JavaScript is that
jQuery has been optimized to work with a variety of browsers automatically.
Unfortunately, JavaScript still has some issues with cross-browser
compatibility due to poor JavaScript implementation practices on the part of web
browser developers.
4) If we use JavaScript, you need to write our own
scripting which may take time.
5) JavaScript is more prone to make mistakes or miss
something than jQuery.
6) JavaScript is less beginner friendly than jQuery.
Now over to you:
A blog is nothing without reader's feedback and comments. So please provide your valuable feedback so that i can make this blog better and If you like my work; you can appreciate by leaving your comments, hitting Facebook like button, following on Google+, Twitter, Linkedin and Pinterest, stumbling my posts on stumble upon and subscribing for receiving free updates directly to your inbox . Stay tuned and stay connected for more technical updates.
If you have any question about any post, Feel free to ask.You can simply drop a comment below post or contact via Contact Us form. Your feedback and suggestions will be highly appreciated. Also try to leave comments from your account not from the anonymous account so that i can respond to you easily..