JavaScript is one of the big three of web hosting: Besides HTML (page structure) and CSS (presentation), the object-oriented programming language offers dynamization of content. But JavaScript is not only applicable in the context of page design. Server-side applications can also be controlled with JavaScript.
Origins of JavaScript
Despite the name, JavaScript has little to do with Java. Originally, the scripting language was to be called LiveScript and was developed by Netscape for the interaction of the Netscape Navigator with Java applets (Java client applications). As actually proprietary software, JavaScript represented a competitive factor for companies like Microsoft dar. These responded to the development of JavaScript with their own solutions such as the script language JScript. Over time, however, JavaScript became the primary scripting language for client-side and (besides php) server-side dynamization.
Client-side dynamization
Probably the most used function of JavaScript is the possibility of client-side dynamization. The client is the web browser. Client-side dynamization means that the contents displayed in the client are manipulated. HTML is the static description of the structure of a Web presence, the so-called Document Object Model (DOM). While CSS (Cascading Style Sheets) is used for the separate design of this "skeleton", JavaScript offers the possibility of moving, deleting or adding HTML elements.
This DOM manipulation (DOM scripting) can be used in many ways. Via so-called event handlers, functions are first bound to certain events. These can be clicks by the user, points in time or the loading of the website. Using the ID's assigned to elements in HTML, event-based changes can then be triggered. This can include everything from programming simple, dynamic forms or table filters to embedding video players or complex, dynamic graphics.
JQuery: The more uncomplicated JavaScript
JavaScript is an example of object-oriented programming languages. As such, the entry threshold for inexperienced web designers is relatively high. Without restricting the functionality of JavaScript (greatly), the JavaScript library JQuery offers a simplified syntax that allows the most common use cases to be created quickly and easily. While JavaScript offers similar complexity and changeability as Java or Python by defining prototypes (instead of classes), instances (concrete objects), and methods (functions bound to objects), JQuery limits vocabulary and structures. The commands have a nestable structure so that the structure can be understood quite quickly. Therefore, unless you are dealing with complex, unusual applications, there is most likely a simple solution in JQuery.
Server-side dynamization: AJAX and Node.js
In addition to DOM manipulation, JavaScript is also used for communication with servers, such as database queries. Since 2009 there is node.js, a framework for server-side dynamization with JavaScript. This was already possible before 2009, but node.js allows an easier integration. This is an advantage for JavaScript programmers, because then they don't have to use other languages like php anymore. In addition, node.js also allows the parallelization of processes. This is an advantage, because too many of these so-called threads can lead to a standstill. With node.js, requests run through a single thread, which can increase performance considerably.
Node.js is an example for the possibilities of AJAX. The acronym stands for a procedure called Asynchronous JavaScript and XML. This principle makes it possible to retrieve content from servers without having to reload the entire page. For many web sites like YouTube, a complete reload after video requests or loading comments would be a big disadvantage. AJAX is also a solution to the problem of accumulating requests thanks to the asynchronous processing as explained above for Node.js.
Integration of JavaScript
The basic integration of JavaScript in web offers works exactly the same way as the connection with CSS files. So there are two possibilities for this: On the one hand, JavaScript can be used in the head or in the body of the HTML document.