HTML5 Zone is brought to you in partnership with:

Located in Raleigh, NC, Imaginovation is a premium web development and design company with a passion for the online capability. Founded in 2011, Imaginovation's educated and experienced team utilizes the latest technologies combined with well-developed strategies to provide its customers with quality marketing and communications products that are both accomplishing and affordable. Imaginovation have mastered their capabilities in research and analysis, marketing, design, development, programming and maintenance, which are carefully combined and applied uniquely to each business. With cutting edge technologies and the passion and motivation to continue to update and innovate, the Imaginovation team offer websites, applications and other online solutions that guarantee affordability, quality and results. Michael is a DZone MVB and is not an employee of DZone and has posted 4 posts at DZone. You can read more from them at their website. View Full User Profile

The Pros and Cons of JavaScript and jQuery

10.10.2012
| 8746 views |
  • submit to reddit

JavaScript is a scripting language and it is mainly used for website development. It is mostly used for client side validation. Over the years, JavaScript has become more popular amongst developers. Initially it was called LiveScript, which was invented by Netscape. Later it was renamed JavaScript.

The most common use of JavaScript is to write functions that are included in the HTML to interact with HTML elements. Some examples are

  • Sending HTML page data to server using AJAX
  • Animating HTML element
  • Validating the HTML form
  • Storing user information that may help for Web Analytic, Ad tracking etc.
  • Browser detection

In brief, below are the pros and cons of the JavaScript.

Pros:

  • Performance: As JavaScript runs on the client side it saves request time and bandwidth of web server.
  • It is a lightweight scripting language and relatively easy to learn.
  • As it run on the user machine, result and processing is relatively fast.
  • Third party add-ons can be used to check code snippets.

Cons:

  • Security issues - As JavaScript runs on the user machine it can be used to exploit for hacking purpose.
  • JavaScript Rendering issues- JavaScript can be interpreted differently by different browsers.

jQuery: jQuery is a JavaScript library designed to simplify the client side scripting of HTML. A developer using this technology would like to write a minimum amount of code without affecting the performance and quality of the code.

Let's take an example,

We can get element value using,

JavaScript

document.getElementById(‘elementid').value

jQuery

$(‘#elementid').val();

jQuery Writes Less, Does More. JQuery library simply adds taste to JavaScript with simplicity and takes JavaScript to next level.

jQuery's syntax is very simpler than JavaScript. It makes it easy to navigate a document, select elements, handle events, and add effects. It also provides the ability to developer to create customized plug-ins. There are many JavaScript frameworks available but jQuery is the most popular. Large technology use jQuery for their web development needs. Companies like IBM, Mircorsoft, and Google just to name a few. Let's take a look on the pros and cons of jQuery.

Pros:

  • jQuery removes the headaches of cross platform Javascript compatibilities.
  • jQuery is very easy to use as compared to other JavaScript libraries and JavaScript as well.
  • jQuery has a large set of library/functions.
  • jQuery has good documentation and help manuals are easily available.
  • jQuery supports AJAX functionality.

Cons:

  • You are no longer writing the native language, so your understanding of what is actually occuring may be limited.
  • jQuery requires to include jQuery library files into project which takes space on the web server. But JavaScript can be used without adding any libraries. Also, if user wants include more jQuery libraries, version conflicts may occur.
In closing, as a Raleigh web design company, we have to choose between these options daily. We hope this article helps you meet your everyday web development goals.
Published at DZone with permission of Michael Georgiou, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Comments

Howard Lewis Ship replied on Wed, 2012/10/10 - 3:36pm

An odd note that "jQuery takes space on the web server".  Perhaps you mean to say, "jQuery adds to the page rendering cost", in that it must be downloaded (if not already cached).  

 Further, you confuse "language" with "API".  With pure JavaScript you are coding against the browser-provided native APIs (which vary between browsers considerably ... not just between IE and the rest of the world).  With jQuery you are coding against an abstracted API that unifies the different browsers. I regularly work in both worlds, and can say what a significantly more pleasant experience it is to use the jQuery APIs than the native ones.

jQuery is a bit larger than some other similar frameworks, and you can see that they are trending towards some modularization, as well as jettisoning some support for very older browsers. That, and proper caching headers, can make a big difference in time-to-page-load (especially on subsequent visits).

That being said, unless you want to invest a huge amount of time in dealing with cross-browser DOM issues, you really don't want to be writing pure JavaScript. You will be opening yourself up to reinventing the wheel, rediscovering all the bugs, workarounds, and rough-edges found by the jQuery crew over the last six or more years, and excluding yourself from a large community of plugins, components, and documentation.

Robert Sanders replied on Wed, 2012/10/10 - 4:32pm in response to: Howard Lewis Ship

Thanks Howard.  The post seems to be to be a fairly obvious cry for attention.  On the other hand some of the basic stuff would be kind of useful for someone who is just getting started, but still overall had my "this is marketing" ringing even before I got to the last paragraph, which makes it obvious what they are selling. Not that there's anything wrong with that, but its always good to know what someone's angle is.

William Soprano replied on Wed, 2012/10/10 - 5:04pm in response to: Robert Sanders

Good pont, Robert.  But we are all out to make money, right?  This post is very relevant because the audience at DZone is vast; from the entry level developer to the experienced one.  This post offers some insight to those who maybe have not used JavaScript or jQuery and for that, I'm happy this article is available. :)

Aaron Mc Adam replied on Wed, 2012/10/17 - 5:05am

I'm sorry, but this article lost all relevance to modern web development with the line "It is mostly used for client side validation."

Usman Ahmad replied on Wed, 2012/10/17 - 6:56am

I'd like to add that although jQuery is the way to go in most cases there are sometimes when you need that simple bit of three line javascript code to get the job done. In those cases, it would be an overhead to add the jQuery minified to your web pages.

 

So while every web developer SHOULD use jQuery (or some similar library) to liberate themselves from the inexhaustive amount of bugs caused by different browsers understanding of how javascript functions should be handled/work, knowing javascript itself would definitely be a huge advantage. 

Josué Santos replied on Wed, 2012/10/17 - 7:14am

I Like GWT (Google Web Toolkit)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.