WebAssembly primer: Get started with WebAssembly

Learn how to make use of the next-generation toolkit for delivering high-performance binary apps in the browser

Become An Insider

Sign up now and get FREE access to hundreds of Insider articles, guides, reviews, interviews, blogs, and other premium content. Learn more.

For two decades now, we’ve had only one programming language available to use natively in a web browser: JavaScript. The slow death of third-party binary plug-ins has ruled out other languages, such as Java and Flash’s ActionScript, as first-class citizens for web development. Other web languages, like CoffeeScript, are merely compiled to JavaScript.

But now a new possibility has arisen: WebAssembly, or WASM for short. WebAssembly is a small, fast binary format designed to be a compilation target for any language, JavaScript being just one of them. With every major browser now supporting the first major incarnations of WebAssembly, it’s time to start thinking seriously about writing client-side apps for the web that can be compiled as WebAssembly.

How do you do this? WebAssembly has long been tied closely to Emscripten, a compiler that translates C/C++ code into the asm.js subset of JavaScript. But as of late, it has become incrementally easier to write code in your language of choice that can then be compiled directly to WebAssembly, with fewer intervening steps.

It is worth noting that WebAssembly apps aren’t meant to replace JavaScript apps—at least, not yet. Instead, think of WebAssembly as a companion to JavaScript. Where JavaScript is flexible, dynamically typed, and delivered through human-readable source code, WebAssembly is high-speed, strongly typed, and delivered via a compact binary format. Consider WebAssembly for performance-intensive use cases such as games, music streaming, video editing, and CAD applications. 

To continue reading this article register now