What made JavaScript the most popular programming language? - Questers

What made JavaScript the most popular programming language?

According to StackOverflow, JavaScript is the most popular language in the world. With a near 100% monopoly of browser scripting, the ubiquity of JS seems inevitable. However, that wasn't always the case. On the occasion of the 27th anniversary of JavaScript, we invited our colleague Kaloyan Kostadinov, JavaScript Engineer at the News UK Tech team, to make an overview of the innovations that propelled this programming language to the top. Read below:

Kaloyan KostadinovIn its early days the web was static. Every action, such as requesting or sending new information, was causing a full page refresh. Dynamic interactions were non-existent, and eventually, a need arose for a scripting language to address that problem. The project took on many names and interpretations in the early days. Every browser had its own unique implementation. Developing cross-browser compatibility was a herculean task. “Best viewed in X browser” banners were a common sight. The web was a mess. After more than a decade of fragmentation and stagnation, excitement rekindled. The technology soon entered its renaissance age. And AJAX was a driving force, pushing forward.

AJAX

Initial versions of JS granted programmatic access to the DOM tree. While this allowed form validation and animations, it did little more. It made the web feel alive, but underneath, it remained still. AJAX and its preceding iterations made it possible to load new content without a page refresh. Variants of the technology were quickly developed by the dominating browsers of the time. The term AJAX was coined around 2005 and then standardized the following year.

Background transactions between the browser and server became cornerstone of the modern web. They would later lead to the creation of countless front-end frameworks and libraries. These would bridge the gap between desktop applications and websites. Developers now had the means to truly breathe life into the web.

Node and NPM

Until the late 2000s, JS was almost exclusively used in the browser. There were ways to run it in a Java environment with Rhino, but it wasn’t until the release of Node.js that it became a viable server option. Node is a runtime based on the V8 engine behind Google Chrome. Developers could now run standalone, performant JS code outside a browser. This enabled not only the creation of servers, but also a local development environment.

Node’s package manager was released soon after to complete the groundworks for the community to flourish. The ability to develop, distribute and access tooling via NPM was a major asset. Currently, the largest repository of packages, it is an indispensable part of web development.

Businesses didn't sleep through the news. There’s a strong advantage in writing the same language on the server and client side. Small teams can juggle between the two applications with greater ease and fewer resources. Larger ones could leverage a bigger pool of shared knowledge and practices.

A paradigm shift occurred in the relationship between developers and JavaScript. These new possibilities would soon inspire the creation of libraries such as Express for writing servers. Angular and React would storm the front end with interactive UIs. React Native would bring JS apps to smartphones. Electron would dо the same for desktop programs. Unbound from the browser, JavaScript will find its way into every possible technological niche.

ECMAScript

A big factor for the stagnant development until 2009 was fragmentation. But that year Yahoo, Microsoft, Google and others reached an agreement. This marked a crucial step towards standardization. Disagreements around the proposal for ECMAScript 4 had clogged the release pipeline for almost a decade. With the draft abandoned, progress resumed. The release of ECMAScript’s 5th Edition, or ES5, would bring the language closer to the one we know today. Later ES6 propelled JS to not only the most used language but also to one that developers loved using. The release added significant new syntax for writing complex applications. Classes, ES6 modules, arrow functions, local scope variables, new data structures and other features made a debut. New practices and patterns emerged for JS development. Annual releases added more incremental features since 2015. The ecosystem and language rapidly approached maturity.

CoffeeScript and TypeScript

The community’s newfound excitement led to the development of new languages and supersets. They would compile to pure JavaScript but would greatly improve the development cycle. Each would bring new features to the ecosystem. And because the ECMA foundation was struggling to keep everyone happy and move forward with development, this was a way to make progress.

CoffeeScript, a complete programming language, came with features inspired by Python and Ruby. Some of these ideas would influence later versions of JS.

While CS has fallen out of favour in recent years, TypeScript is all the rage. It brings syntax close to programming languages such as C# and Java, but it “stays out of your way”. It’s not an entire language like CoffeeScript. It’s a superset. Valid JS is valid TS. It allows using only the features you need. That might be a big reason why it remained popular after the ES6 release.

In the early 2010s, these languages bought extra time for JS to catch up. Thanks to them, companies could scale their operations using JavaScript. Many of the improvements they featured now have equivalents in the latest ECMAScript releases.

Conclusion

Due to its history, some think of JavaScript as an undercooked attempt at a programming language. And they may have a point. Early versions made JS easy to ignore for anything beyond sparse interactions in webpages. The initial spec targeted not engineers but people such as designers. The simplicity was intentional. Grown beyond the initial design, some of those decisions plague JS to this day.

New features are added every year. However, in the spirit of backwards compatibility, the new solutions often didn’t fix but instead superseded the problems. A prime example of this is the continued existence of the “var” keyword, or the various native ways you can make an HTTP request, all valid to this day. This is a plain demonstration of the evolution and strategy employed to improve the language.

Despite that, the language, ecosystem and community have bloomed over the past decade. As the language and the web in general mature, the tooling around them is bound to follow. And it's the tooling that provides a lot of the much-needed improvements.

The creation of this imperfect tool set the stage for innovation. Although approaching maturity, the space is as lively as ever. I'm excited to see what the future of JavaScript will look like.


Interested in new career opportunities with JavaScript? Check out this React and Node.JS roles we currently have.