Dynamic duo or mortal enemies?

JavaScript or WebAssembly: Is WASM the superhero JS needs?

Sarah Schlothauer
© Shutterstock / rudall30  

WebAssembly has been met with much fanfare with some even claiming it as a much needed match for JavaScript. Is there really a competition between the two? Or is it more like a partnership?

Rumors of JavaScript’s demise

Let’s not get hasty and make unrealistic predictions. JavaScript will not be replaced any time in the foreseeable future. It’s been to the doctor and it shows no sign of slowing down.

According to the biannual report from RedMonk, JavaScript is the number one most popular programming language. (The study’s ranking is taken from a language’s activity on GitHub and Stack Overflow.)

Now as blockchain explodes in popularity, JavaScript is finding a home there, as well as alongside web development and other more common use cases. No matter your feelings on JS, it is adapting to a new age and still leads the way across industries.

However, the love-hate relationship with JavaScript is real. Hypothetically, if JavaScript disappeared, would WebAssembly fill its shoes?

Is WebAssembly a game changer for your JavaScript woes? It is still a new kid on the block, with the first public announcement dating back to June 2015. Despite its youth, it has use cases both outside of and inside the browser.

SEE ALSO: Life: WebAssembly on your smart fridge? This new VM written in Go makes it possible

I’m crying from r/ProgrammerHumor

Replacing the standard

At JS Monthly London, Colin Eberhardt discussed the possibility of WebAssembly taking over JS in his talk “WebAssembly and the Death of JavaScript“. Death is an overstatement, however Eberhardt discusses the idea that it will no longer be a monopoly. One of the big issues behind JS is that it was not designed to be a compilation target.

For more than 20 years JavaScript has been the only ‘native’ language of the web. That’s all changed with the release of WebAssembly…Born out of asm.js, a somewhat crazy concept dreamt up by Mozilla, WebAssembly was designed from the ground-up as an efficient compilation target for the web. It promises smaller payloads, rapid parsing and validation and consistent performance … and it’s ready to use, right now!

Colin Eberhardt

WebAssembly’s FAQ page agrees:

“WebAssembly minimizes costs by having a design that allows (though not requires) a browser to implement WebAssembly inside its existing JavaScript engine (thereby reusing the JavaScript engine’s existing compiler backend, ES6 module loading frontend, security sandboxing mechanisms and other supporting VM components). Thus, in cost, WebAssembly should be comparable to a big new JavaScript feature, not a fundamental extension to the browser model.”

A recent blog from Mozilla found that “in the latest version of Firefox Beta, calls between JS and WebAssembly are faster than non-inlined JS to JS function calls”. If JavaScript’s speed is one of the reasons holding you back from a happy marriage with the language, WebAssembly can soothe some of that burn. A study by Winston Chen also found that for smaller array sizes, JavaScript was the winner. However, for large array sizes WebAssembly took the lead. (Are these results surprising? You can check out the code for it here.)

SEE ALSO: Node.js and JavaScript to form a unified ecosystem

Learning WASM with Walt

We all know WebAssembly is difficult to learn. Meet your new teacher: Walt. (Hey devs, where’s the Jesse repo?)

Walt creates a platform to learn WASM by introducing a familiar syntax. It has language extensions, fast compilation, and uses only typed JavaScript (No C/C++ or Rust required).

It is “an alternative syntax for WebAssembly text format. It’s an experiment for using JavaScript syntax to write to as ‘close to the metal’ as possible. It’s JavaScript with rules. .walt files compile directly to WebAssembly binary format.”

(You can even test it out in your browser!)

So, what’s the verdict?

WASM isn’t a magic bullet and like it or not, JavaScript is most likely going to continue to dominate charts.

As it is now, WASM cannot replace JavaScript and it was never intended to. (Even their own FAQ addresses this misconception. “While WebAssembly will, over time, allow many languages to be compiled to the Web, JavaScript has an incredible amount of momentum and will remain the single, privileged…dynamic language of the Web.”

However, WASM can move JS to a script role. Think of it as a sidekick with a complementary role. Together, they can make an iconic duo.

What do you think? Does JS need to go?

Sarah Schlothauer

Sarah Schlothauer

All Posts by Sarah Schlothauer

Sarah Schlothauer is an assistant editor for She received her Bachelor's degree from Monmouth University and is currently enrolled at Goethe University in Frankfurt, Germany where she is working on her Masters. She lives in Frankfurt with her husband and cat. She is also the editor for Conditio Humana, an online magazine about ethics, AI, and technology.

Leave a Reply

2 Comment threads
0 Thread replies
Most reacted comment
Hottest comment thread
2 Comment authors
Alexdefunkydrummer Recent comment authors

>Let’s not get hasty and make unrealistic predictions. JavaScript will not be replaced any time in the foreseeable future. It’s been to the doctor and it shows no sign of slowing down. According to the biannual report from RedMonk, JavaScript is the number one most popular programming language.

Two words: PERL, PHP.


WebAssembly will act as a JavaScript replacement. I have no doubt of this. It’s just that it won’t be used by everyone. There are a ton of developers who absolutely hate JavaScript. It’s one of the leading reasons many don’t get into web development. As WebAssembly matures and allows garbage collection and browser API access, many developers and companies will switch. It will be gradual.