Will JavaScript ever die? Can WebAssembly replace JS?
Tags: webdev, javascript, webassembly, programming
Published: 2023-09-02 08:52:31

JavaScript will never die. It is a crucial component of the browser and other applications, including AI. If someone or the Web Browsers decide to adopt something else, it won't be feasible for them because of specific guidelines, which will break the entire Internet.

It would create the same situation that ECMAScript developers faced when people criticized JS and its design. However, they could not change the design as it was not feasible for them to alter the fundamentals of the language. There's a reason for allowing var to stay in the language with its nerve-racking problems.

Developers will use JS with a combination of frameworks, like React or Angular (with TS), to overcome its strange problems, like synchronous behaviours, type checking, and dynamic typing, and because of the massive frameworks, the deep-rooted relationship with browsers, and old applications on the Web, JavaScript never tends to die and only advances.

WebAssembly could give competition, and I will talk about that. However, since we cannot replace those quirks by modifying the fundamental design of JavaScript, does that mean JavaScript is a crappy language?

## The rise of JavaScript

Since the release of JavaScript in 1995, it has been the most popular language of choice. Recently, it became more famous because of its use cases becoming more diversified into multiple fields beyond the barricades of the Web.

Additionally, the demand for websites and web-based solutions increased recently, and JS acts as the sole language for the Web.

It started supporting server-side applications to make chatbots and much more. According to the Stackoverflow 2023 Developer Survey, 2023 marks a streak for JavaScript as its eleventh year continuously as the most commonly-used programming language. It is also the preferred language for beginners and professional developers.

![ECMA History](https://cdn-images-1.medium.com/max/720/1*JdmetZhsu32cuV1G7N5Mfw.png)

JavaScript continued to gain popularity after the major update in 2015 named ES6. It evolved from a language used to put animations and 'makeup' to a significant programming language used to create large and complex applications.

JavaScript continues to rank as one of the top languages on Github, and companies like Google, Facebook, and Netflix use it for their codebases. It has a massive market share. In fact, it dominates the entire market.

If truth be told, the interface for AI models, chatbots, and others are converted, transpiled, or moved from Python to JavaScript because users use the Web to communicate with these ML models, and the Web requires JavaScript.

A few APIs communicate with each other within the browser to make the entire interface between the robot and humans possible. But in essence, the compilation takes place because Python is for research, training, dealing with datasets, development, and fine-tuning purposes.

But the Web remains dominated by JS, and it becomes necessary for institutions to deploy it using JS.

The question is - How do you push the model to the Web for users? Therefore, folks involved in AI are utilizing and researching Web GPUs to run the models on the users' machines. They cannot use Python for that. Thus, JavaScript. Even if you use a framework to use Python on the Web, it transpiles the code to JavaScript anyway.

You cannot do research for datasets and AI models with JavaScript. However, JavaScript as a programming language without any other supplementary component is not getting enough attention. Most developers use JavaScript with some further combination of frameworks, environments, and libraries, but why?

## JS Frameworks, Libraries, and TypeScript take over

Some people argue that JavaScript has already dead. The attributes, such as our browsers and frameworks or libraries based on JavaScript, are only keeping it alive.

Besides, JS has many quirks, and it is famously known for them, like the single-threaded & synchronous behaviour, which restricts multiple processes simultaneously running while affecting efficiency. I wrote about dynamic typing, synchronous, single-threading, and others previously. You can read the piece below for more details on those topics.

{% embed https://medium.crackjs.com/what-do-single-threaded-synchronous-non-blocking-and-asynchronous-mean-in-javascript-def613a86767 %}

Amongst other problems, JS' popularity continues to decline, indicating reduced search results and not based on the usage of JS by developers in real-world applications as a standalone language. However, there's always more to the story. If something declines, another counterpart emerges.

Look, vanilla JS has many issues. Most people do not even like to use it without any framework or library.

Therefore, according to Google Trends & StackOverFlow Trends, the search results for JavaScript have declined over the years (shown in blue). I included TypeScript for extra reference (shown in red).

![Google Trends of JavaScript Decline - Afan Khan](https://cdn-images-1.medium.com/max/720/1*YmWoQoOzgKkJKGBLgrM05A.png)

**However, JavaScript expanded beyond simply a plain programming language for client-side applications**. It endures large server-side applications, powers frameworks, and multiple libraries. Therefore, the search results of 'JavaScript Frameworks' have risen from the dead against Plain JS. Take a look.

![JavaScript VS Frameworks](https://cdn-images-1.medium.com/max/720/1*i46MxXmDpkHd_JTeK97Oow.png)

Most of the applications nowadays using JavaScript are not Vanilla (Plain) JS. It is because plain JS has many problems, which leads to some developers criticizing and stating that JavaScript cannot handle massive and more complex applications. Therefore, developers combine with frameworks and supersets for an evident reason that I will cite in a bit.

All of the applications created using JavaScript are in some varied runtime environment, like Node JS, or a framework, like React, to optimize or capitalize on the benefits of JS while eliminating its weird quirks. Therefore, the need to learn these frameworks is increasing day by day.

**JavaScript is getting used, but not as a plain simple language.** Instead, people combine it with various technologies based on JavaScript, which doesn't remark it as dead or even obsolete. Similarly, students received a mechanical pencil to make the standard pencil better.

However, that didn't replace the standard pencils at all. The pencil remained alive to write temporary pieces in one form or the other but with specific upgrades. And this only makes JavaScript more powerful.

![React VS Angular VS Vue](https://cdn-images-1.medium.com/max/720/1*dSLCfMxiX70wDmtk7IwWaw.png)

Only the developers with the HTML, CSS, and JS tech stack use plain JavaScript with external technologies. I'd argue the number of these developers is enormous, but the ones using frameworks are multifolds of this.

JS works fantastically and can build anything as a language combined with other forces in the same playing field, including TypeScript or any other framework. Most applications nowadays use JavaScript to create their software or solve problems with frameworks. If you have developed JS applications, you would know.

Plain or Vanilla JS introduced so many problems in terms of scalability that the AngularJS team decided to use TypeScript for their next release, refactored the code into TS and renamed the framework to Angular. For the same reason, JS holds diverse sets of frameworks and libraries.

Let us all accept that JavaScript without any external input or technology has various bugs, but that doesn't make it obsolete. Instead, it makes the language more assertive, which enables problem solvers to bring more intense and extravagant solutions.

### Frequent Updates & Relevance

Besides, JavaScript continues to get consistent updates every year to improve its core feature. The ECMA, responsible for JS, merely released five updates to the language between 1997 to 2011. Throughout the first decade, the updates were inconsistent. Not to mention, Indian colleges, including mine, teach the ECMA release of 2009 called ES5.

However, the modern features in JS arrived in 2015 (ES6), and since then, the language started receiving an update every year. Along with community support, the updates to the language have remained consistent, which makes the language more adaptable to modern standards, frameworks, and libraries.

**It continues to stay relevant.** No one can say it is outdated anymore with these frequent updates. We continue to get features like Nullish Coalescing, which got chucked in the 2020 update.

We can use frameworks, libraries, and other solutions like TypeScript to overcome the issues of JavaScript since it is well-entrenched in the browser. But why deal with these issues in the first place?

## Why even use JS with so many problems?

**We are stuck with it**. Every browser, every application, every framework, and everyone uses JavaScript. It is directly well-entrenched in the Web to an extreme degree. The entire technology has stabilized itself into the whole Web. It is exceptionally dominant, including Java, Python, and C#.

Therefore, why not create or use solutions that keep us away from bumping into the hardships of JS? And that is why we have TypeScript and TS-based frameworks. Developers prefer TypeScript and even TS compiles to JS.

JS is like time, a fundamental aspect of our existence. It moves forward irrespective of our desires or actions, and we cannot eradicate it. However, to use time efficiently, we can learn time management skills and use that time correctly. In the same way, we can use frameworks, libraries, supersets like TS, and other alternatives to cover the misery of JavaScript.

Most JS-based frameworks appeared in the past five to ten years. React remains the most popular framework because it has a large community around it, and this large community appeared so quickly, indicating the rise of frameworks and JS. The large community keeps improving the existing tools and frameworks around JavaScript.

A new framework or library suffers through this portion of its divulgence to the general public. When you have a large community, you have people to ask questions, fall back upon for queries, etc. And JS remains popular for this reason.

Additionally, the '**Do not break the web**' principle built decades ago and placed by the TC39 committee protects old websites. It states that developers or existing websites can add new features to an existing website but cannot change or remove it.

![404 Animation by Swagata Biswas on Dribble](https://cdn-images-1.medium.com/max/720/1*uK5as2Sy5wCpSOIP2Nd0zw.gif)

ECMA cannot make significant changes to JavaScript for the same reason. If they did make changes, half of the websites on the entire Web would return 404.

Transformations to the features or their removal could lead to existing websites potentially crashing or becoming obsolete. The principle guarantees that existing websites remain functional and not affected even if they got built when Peaky Blinders lived in Birmingham, UK.

Even if a new language attempts to replace JS, it cannot modify the existing functionalities. Thanks to this principle, JavaScript maintains its dominance. Therefore, even WASM faces a couple of nightmares trying to work with the Web and requires the help of JS. But can WASM replace JavaScript?

## Can WebAssembly replace JS?

_WebAssembly_, abbreviated as _WASM_, is a **binary** instruction format-based low-level language on the Web, which ordinarily deals with binary code in the series of 0s and 1s, and people argue that it can replace JS. However, as of now, peers believe that WebAssembly complements the work of JS than being an alternative.

You can write code in C, compile it to WASM, and then write JS wrappers to transpile and call those exported C functions. Do you see how WASM complements JS? It requires JS to interact with the DOM to execute code on the browser.

For example, Figma, the UI/UX design platform, uses Emscripten, a WebAssembly transpiler for C and C++, and has been using it for years. Not to mention, WebAssembly got released in 2017, so it is still in its early days.

Even the Firefox team used asm.js with the same transpiling tool, Esmcription, to make real-time 3D games using C++ and then put them inside a web browser. For your reference, asm.js was like WASM, coined by the folks at Mozilla in 2013. WebAssembly is the successor to asm.js.

![WebAssembly & JS Flow](https://cdn-images-1.medium.com/max/720/1*GhvRmRRmAmOVCMHyU8ZM_Q.png)

WASM has a faster loading speed and better resource utilization than JavaScript because it is a low-level language. For instance, fastq.bio used WebAssembly to speed up their DNA sequencing calculations.

However, JavaScript provides a more simplistic approach. I am not sure how Binary Code can compete with a high-level language. It feels like walking backwards in the invention of Programming languages and returning to the Assembly days.

Heck, people still use PHP and jQuery. If people cannot move on from worse technologies than JS, we cannot expect them to switch to WASM so soon. Switching from PHP to JS would be more smooth than learning a binary-based language from JS. By the way, WASM primarily targets the back end since it has a lot of problems, including the DOM in the front end.

Even if a language tries to replace JS by implementing a DOM feature, that language will become slow in and of itself. Even though it will not become as slow as JS, it will face distinct consequences because the browser is slower than JS. JS becomes slow due to many reasons bestowed by the Web.

WASM merely gets supported by a few browsers and is still in the development phase. For extremely certain use cases, folks could prefer WebAssembly over JavaScript. But as the Web remains married to JavaScript, the WebAssembly alternative could become a headache.

As we spoke about community, JS has the upper hand, and WebAssembly is not widely adopted yet. The majority of frameworks depend on and use JS because the browser does. Every website is on JS, and if browsers primarily switch to WASM, I could witness the next Great Depression of 2008 in the Software Engineering community. Consider the graph by Stackoverflow.

![WebAssembly VS JS in StackOverFlow Trends](https://cdn-images-1.medium.com/max/720/1*qEMO0_eQtwAnCJEsdY26pw.png)

WASM is more gruelling to code, with no community support, and is not adoptable yet. JS is a high-level language, closer to the human language and straightforward for us to understand. Assembly was a low-level language, and no one fancied getting involved with that language in their lifetime unless they decided to welcome trouble through the front door.

WebAssembly will continue to work with JavaScript in the compilation process by speeding up the loading time and much more. However, it will not attempt to replace JavaScript. Moreover, it cannot replace JS. They are not competing.

WASM remains locked into the JS runtime environment. Front-end developers will face issues with JS, while back-end developers could get hurt if WebAssembly continues to succeed. The browser contributes to front-end-based problems within WebAssembly but can allow the back-end to adopt WASM. JavaScript will work in the front end, and WASM alongside JS will work in the back end, which is the dream for some.

Now that we know the factors that could and do affect JS, what does that mean for you?

## Summary

A lot of criticism of JavaScript comes from ignorant folks, unwilling to learn the language and the basics of it. They leap to learn the intermediate and advanced concepts, only to realize that JS has a bunch of quirks that we can overcome by understanding its basics.

As the experts say - If you know JavaScript, you can effortlessly pivot to a new language. It is like learning to play the piano.

You cannot use a framework or library without a robust fundamental knowledge of JavaScript. I tried to use React with a minimum or beginner-level understanding of JS, and I miserably failed. That story is in my upcoming book called CrackJS, based on JavaScript. And if you learn the fundamentals of JavaScript, which applies to all other Programming languages, you can switch or change effortlessly to other languages.

Even WebAssembly does not have the same freedom or capabilities allowing developers to switch, and it only allows developers to use other languages to work with it. It is merely a transpiler.

Nonetheless, this means that students must continue to learn JS. JavaScript was never more alive than it is today. If you are someone who does not know JS yet, I highly recommend you learn it to solve problems in the real world.

JS enables you to make Desktop, Mobile, Web, and other sorts of applications with the help of these diverse frameworks. Statistically, even if plain JS does not get lots of attention, you must learn JS to work with its frameworks.

Nothing in the modern world gets created without a framework powered by JavaScript, and to use a framework, you must learn plain JavaScript to its most basic fundamental level. Irrespective of whether Plain JS gets searched often, it is the foundation of most modern applications.

Nowadays, companies use the Web version of their software to create their desktop version, and the Web gets powered by JavaScript, so you're back to square one. You have an entire community of developers to ask for help. The number of new packages that arrive in the JS community is endless. You can create anything with it nowadays.

Besides the real-world problems you can solve using JavaScript, many corporations, startups, and companies require engineers proficient in JavaScript, especially when AI grows at a breakneck pace. And the number of jobs requiring skills like React JS keeps increasing.

![React JS Jobs Metrics](https://cdn-images-1.medium.com/max/720/1*iDMAzuitlttF-aK9FG9I-Q.png)

JS is like the Real Estate of the Software Engineering world. You require a lot of funds to buy an asset or property, like the way you need an extensive fundamental knowledge of JavaScript to build software like Notion. Even Notion, the productivity app, uses Next JS, Node JS, and React with other external technologies related to JS.

But once you get started, the long-term appreciation and benefits those properties or JS skills will bring you that you will regret not taking it. New frameworks will emerge, and some will become non-existent, but JS will always remain stable.

As long as the Web and Web Browsers exist, JavaScript will breathe. Even with frameworks and layers/subsets like TypeScript, everything is transpiled to JavaScript. As long as we keep using the Web, JavaScript will stay.

---

By the way, I am writing a book called CrackJS, which is based on and covers the fundamentals of JavaScript. If you want to learn more about JS, follow me on this journey of writing this book with these articles trying to help developers worldwide.

If you want to contribute, comment with your opinion and if I should change anything. I am also available via E-mail at _hello@afankhan.com_.

The notion document containing the resources/sources used to write this piece with drafts - [CrackJS Notion](https://crackjs.com/will-javascript-die-notion).