TOC

The community is working on translating this tutorial into French, but it seems that no one has started the translation process for this article yet. If you can help us, then please click "More info".

About JavaScript:

JavaScript libraries

I just promised that this tutorial would concentrate on the core JavaScript experience first, and only later discuss the web-related parts of it, but I do want to mention one subject which relates to the web before we get started: JavaScript libraries.

JavaScript is a highly extensible language, so it's very easy for you to add your own functionality to the language and use it as if it was a natural part of JavaScript. Quickly after the introduction of JavaScript, skilled developers took advantage of this fact and started to build their own libraries. These libraries would add the functionality they used a lot, or made existing functionality a lot easier to use - a kind of shortcuts to do things easier and with fewer lines of code.

One of the main reasons for developers to start adding these shortcuts was the fact that, back in the old days, especially during the browser wars, the various browsers had their own, custom JavaScript engines. This meant that while MOST of the functionality was the same across the most popular browsers, there were small differences, basically meaning that you couldn't rely everything to work the same way for all your website visitors.

So, a lot of the initial libraries were basically just functions that would check which browser the visitor was using and then work around whatever issue or shortcoming this browser might have, to ensure that everything worked as intended, no matter what.

Most developers would just keep their libraries to themselves, or within the company they worked for, but some libraries were released to the public, usually because they added functionality that was deemed important to a lot of developers. The release of these libraries allowed other developers to chip in and add even more functionality, while perfecting the existing.

jQuery

One of the first JavaScript libraries to reach common use was jQuery. It was first released in 2006 and it mainly made it a LOT easier to find and manipulate elements in the DOM (Document Object Model), which, on a website, is simply all the elements that makes up the layout and the content. It also made sure that all web-related functionality would work across all major browsers as intended.

During the following years, jQuery received continuos updates, allowing the end users to do more and more. Examples of this is AJAX requests, animations and a heap of utility functions, basically just making it easier for the developers to accomplish simple and advanced things with few lines of code.

Of course, the success of jQuery spawned a LOT of competing libraries. One of the first ones was mooTools, which was released in 2007, but this was just the tip of the iceberg: While jQuery kept growing the amount of functionality, other developers insisted on releasing slimmer alternatives to keep the size and complexity to a minimum, or libraries which simply did things completely different.

jQuery usage: Now and in the future

Today, jQuery is considered outdated by some developers. They feel that it tries to do too much, and some of the problems it originally solved is no longer an issue, thanks to the development of JavaScript and the consolidation of JavaScript engines. However, according to Wikipedia, "As of Aug 2022, jQuery is used by 77% of the 10 million most popular websites".

So, there are definitely many alternatives to jQuery, and one of them is simply to NOT use a JavaScript library, but simply rely on the core JavaScript engine, which today is MUCH better than it was in 2006 when jQuery was released. However, for beginners, jQuery is a fine starting point. It makes things a lot easier, allowing you to focus on the fun tasks of creating dynamic websites, while leaving the boring and tedious parts to jQuery.

Summary

JavaScript libraries makes it easier to develop dynamic websites, and while they were definitely more necessary 15 years ago than today, you should still consider giving them a try if/when you dig into writing JavaScript for the web.


This article has been fully translated into the following languages: Is your preferred language not on the list? Click here to help us translate this article into your language!