Just a JavaScript story

Arthur Chardon
neoxia
Published in
9 min readApr 25, 2024

--

1995, JavaScript was developed in 10 days to introduce dynamism in a fresh new technology called the World Wide Web.

2023, A billion websites and almost 30 years later, 98% of the websites rely upon JavaScript. Let’s take a look at why “JS” has risen to prominence by surrounding itself with a complete ecosystem of development.

Script. JavaScript

In 1993, the Web was graphical thanks to markup and stylesheets languages, but the Web was static. Web pages were mere tables of contents. In order to introduce dynamism in the prosperous web development market, browsers needed to equip themselves with a scripting language.

In 1995, Brendan Eich from Netscape developed JavaScript, a language integrated within Netscape’s web browser: Navigator. In parallel, Microsoft introduced its own browser, Internet Explorer before reverse engineering Navigator’s interpreter to create JScript.

With these new technologies released, dynamic websites poured in. Most of the market was interacting with them either on Internet Explorer through JScript or Navigator with JavaScript. However, due to the differences in the implementation between these languages, websites were often only optimized for one or the other browser.

During the next few years, Netscape chose to standardize JavaScript by submitting it to Ecma International, leading to the release of the EcmaScript language specification in 1997 as a continuous evolving standard for web browsers scripting languages. Meanwhile, thanks to Windows, Internet Explorer gobbled up market shares until reaching a 95% peak in 2004. At the time, a web developer had to choose between JScript and JavaScript for its client-side scripting.

“Best-viewed in…“ tags for 90’s websites

Big browser is watching you

Early 2000s were marked by the harsh domination of Internet Explorer and a relative stagnation of client-side scripting. However, the situation shifted when Mozilla, a free software community originated from Netscape, released a new browser. Firefox emerged from the smoldering ashes of Navigator, and took significant market shares from Internet Explorer.

In the meantime, standardization with Ecma continued to allow all browsers — even Internet Explorer — to have a common base for their engines. Thanks to this strong standardization, several developments from open-source communities allowed JavaScript to refresh its popularity. New papers and libraries — such as Ajax or jQuery — allowed developers to become more creative, pushing back the boundaries of JavaScript.

At that time, the web development ecosystem began paving the way for the first golden age of JavaScript. On the one hand, libraries were shattering JavaScript’s limits for developers. On the other hand, aligned compatibility of the trendy browsers allowed websites to be correctly displayed in every users’ computers. At this point, JavaScript was the goto language for client-side development.

Firefox’s arrival in the browser war (downloads count)

You’re gonna need a bigger engine

From a scripting point of view, a web browser has a browser engine, interpreting code through its JavaScript engine. For example, Firefox has the Gecko browser engine with the SpiderMonkey JS engine.

In 2008, Microsoft and Mozilla ate the whole pie. But a competitor hungry for internet technologies known as Google, released its own browser called Chrome. It first includes the WebKit browser engine and a new JavaScript engine called V8. When talking about performance, the tests are unanimous. While the competitors are great sprinters, Chrome simply leaves them in the dust.

Several factors are to be considered but the main one being the use of just-in-time compilation by the V8 engine. It rapidly devoured all the browsers market share and its appetite has not stopped yet. Other vendors promptly updated their own engines with JIT compilation to keep up on performance.

Chrome dominates JavaScript’s benchmark

One language to rule them all

Less than one year after Google’s V8 release, Node.js, a runtime environment running on the V8, was announced. Until now, server-side JavaScript was a niche. Therefore, being a full-stack web developer required to be fluent with different languages and to switch between contexts while coding. Node.js came in handy to represent a JavaScript everywhere paradigm, allowing developers to rely on a single language for both frontend and backend.

Node.js comes with npm, a package manager that allows programmers to easily publish, install and update JavaScript packages. The packages and the modules provide a vast range of capabilities from networking to file system I/O, extending the possibilities around web servers. Moreover, Node.js has been designed to easily scale up and allow concurrent executions.

Losing none of its popularity, JavaScript found in Node.js an audience using it to develop web servers and non-browser applications outside of its birthplace the web browsers.

Nobody’s perfect

JavaScript’s popularity is only matched by its shortcomings.

First of all, it needs a way to modularize programs for developers to take advantage of code reusability. The first solution came from the open source community, notably a Mozilla engineer by the name of Kevin Dangoor who released CommonJS, a set of standards to implement synchronous modules on JavaScript. It is first thought of as a server-side tool, quickly integrated with Node.js but without a direct browser implementation. Modularization will be finally properly standardized with its introduction in EcmaScript as EcmaScriptModules. (ES2015)

Among programming languages, JavaScript is often criticized for its lack of inner discipline. Indeed, JavaScript has a weak and dynamic typing which proved to be error-prone during interpretation increasing chances of a buggy application. This was the main motivation between the design of TypeScript by Microsoft. TypeScript is basically an extension of EcmaScript 6 with more strict language specification such as typing. In order to be executed, a TypeScript code first needs to be transpiled into JavaScript.

In addition to TypeScript, frameworks such as Angular or React were developed to help modularizing programs, and enhance code reusability. Thus, combined with TypeScript they help developers in creating cleaner and more stable applications by being more restrictive.

Back to the future

Although the web ecosystem promptly moved towards full support of new JavaScript versions, multiple use-cases required tools to ensure compatibility of older engines. Since a significant part of the audience is not updating their browsers on their latest version, their engine may natively not support recent JavaScript features.

Therefore, some libraries known as polyfills are developed to complete a recent program with functions replicating recent features in older standards. core-js being one of the most popular of these libraries, can be integrated with Babel, a JavaScript transpiler. Such transpilers are used to convert ES6+ code into backward compatible JavaScript.

It is always possible to check compatibility of JavaScript’s new features with different versions of engines or compilers through EcmaScript’s compatibility tables. All these tools are precious to ensure that your brand new application will decently run on your grandparent’s old Internet browser.

Completing browsers features with polyfills

An unmatched allrounder

JavaScript has become the keystone of the web, but beyond browsers, a whole programming world never stopped improving in the meantime. Consequently, JavaScript suffers from performance limits when compared to native applications languages such as C or C++. Above efficiency, desktop applications portability and code reusability are severely restrained by the lack of compatibility between JavaScript and the other languages.

Mozilla took a first step in 2013 by implementing asm.js, a highly optimizable subset of JavaScript designed to be performance-focused and relying on tools to convert from other languages. It was later turned obsolete by the release of WebAssembly in 2017, a binary format that soon became a W3C recommendation. It puts an end to JavaScript’s exclusivity of front-end execution. However, it remains quite niche and performance-focused and even relies on JavaScript to perform some operations.

While system programming languages are timorously walking towards web browsers, JavaScript also takes its chances outside of its league. With frameworks like Electron or Tauri, it has become possible to develop desktop applications with the same stack as browsers, HTML, CSS and JavaScript. For instance, Electron is based on Node.js with its interface being built upon Chromium (Open source Google Chrome).

Last but not least, JavaScript completes its stone collection with a step in mobile development, through frameworks such as React Native or Ionic. Although it is not as suited for mobile than Swift or Kotlin, JavaScript may also run apps on your pocket devices. By combining client and server side web development, along with mobile and desktop apps, JavaScript has become an ubiquitous language for software developers.

To infinity and beyond!

Today, JavaScript is arguably the most popular and wanted programming language, especially in web development. Mastering it is a must have for any web developer due to its versatility and ubiquity. It is still supporting the EcmaScript standard, iterating versions over the years implementing more and more features.

Besides its harsh dominance over front end, it is a top competitor over back end development and takes its chances in other programming contexts. The wide community, along with powerful companies, pushed the possibilities with a vast array of frameworks, libraries and implementations around JavaScript. From video games with WebGL to virtual reality with WebXR, examples of new possibilities on web pages flood the internet.

JavaScript was the first web language back then but over the years turned out to be essential for web developers. It is relatively unlikely for it to be replaced in the next few years because of the stability it inspires, but we will continue to see new assets coming to complete its environment.

Diving into the jungle

JavaScript was born for the browsers, but slowly evolved inside a more complex ecosystem with the arrivals of new environments and extensions. Let’s clarify a few of them.

The main purpose is to turn human creativity into machine instructions.

JavaScript’s goal as a scripting language is to allow developers to write human-understandable code. This code should be converted into machine code for the computer to perform actions. Depending on the context, such a converter is called either a compiler or an interpreter.

A Javascript engine is a component that can execute JavaScript code. It includes an interpreter and may have a JIT compiler.

To enhance the possibilities, a JavaScript engine is often included in a context with APIs allowing it to communicate with other softwares or computer I/O. This context is called a JavaScript runtime environment with one example being Node.js.

In the web context, these environments are a graphical software called a web browser (Chrome, Opera, Firefox etc) This software includes classical features to work in a graphical operating system and a browser engine.

The browser engine is composed of a layout and render engine that manages HTML and CSS through the DOM. In addition, it has a JavaScript engine and Web APIs, for these two engines to interact together.

When a user accesses a web page, its browser queries a server to retrieve the files composing the page. When querying, it includes metadata specifying browser version. Babel.js is a tool that uses polyfills such as core-js to convert developer code into a browser-compatible equivalent of the page or application.

EcmaScript is the definition of what JavaScript is meant to be. In other words, EcmaScript is the recipe, with the rules and the expectations while JavaScript is the meal, a concrete application of such specifications. The standard can be found on the language specification page. The support of its features by web browsers and other runtime environments can be consulted on compatibility tables.

Since it matters for developers to know in which environment their code will be running, understanding market shares of each browser can be crucial. Worldwide, Chrome (and Chromiums) is a serious leader (60 to 80%) with the V8 engine versus contenders such as Safari with JavaScriptCore or Firefox with SpiderMonkey. Serious differences rise when observing at national scale though, for example with Apple’s (Safari) popularity in most western countries.

--

--