Get to know MDN better
This feature is well established and works across many devices and browser versions. It’s been available across browsers since October 2017.
* Some parts of this feature may have varying levels of support.
The WebAssembly JavaScript object acts as the namespace for all WebAssembly-related functionality.
Unlike most other global objects, WebAssembly is not a constructor (it is not a function object). You can compare it to Math, which is also a namespace object for mathematical constants and functions, or to Intl which is the namespace object for internationalization constructors and other language-sensitive functions.
The primary uses for the WebAssembly object are:
Indicates an error during WebAssembly decoding or validation.
WebAssembly.GlobalRepresents a global variable instance, accessible from both JavaScript and importable/exportable across one or more WebAssembly.Module instances. This allows dynamic linking of multiple modules.
WebAssembly.InstanceIs a stateful, executable instance of a WebAssembly.Module
WebAssembly.LinkErrorIndicates an error during module instantiation (besides traps from the start function).
WebAssembly.MemoryAn object whose buffer property is a resizable ArrayBuffer that holds the raw bytes of memory accessed by a WebAssembly Instance.
WebAssembly.ModuleContains stateless WebAssembly code that has already been compiled by the browser and can be efficiently shared with Workers, and instantiated multiple times.
WebAssembly.RuntimeErrorError type that is thrown whenever WebAssembly specifies a trap.
WebAssembly.TableAn array-like structure representing a WebAssembly Table, which stores references, such as function references.
WebAssembly.TagAn object that represents a type of WebAssembly exception.
WebAssembly.ExceptionA WebAssembly exception object that can be thrown, caught, and rethrown both within and across WebAssembly/JavaScript boundaries.
Compiles a WebAssembly.Module from WebAssembly binary code, leaving instantiation as a separate step.
WebAssembly.compileStreaming()Compiles a WebAssembly.Module directly from a streamed underlying source, leaving instantiation as a separate step.
WebAssembly.instantiate()The primary API for compiling and instantiating WebAssembly code, returning both a Module and its first Instance.
WebAssembly.instantiateStreaming()Compiles and instantiates a WebAssembly module directly from a streamed underlying source, returning both a Module and its first Instance.
WebAssembly.validate()Validates a given typed array of WebAssembly binary code, returning whether the bytes are valid WebAssembly code (true) or not (false).
The following example (see our instantiate-streaming.html demo on GitHub, and view it live also) directly streams a Wasm module from an underlying source then compiles and instantiates it, the promise fulfilling with a ResultObject. Because the instantiateStreaming() function accepts a promise for a Response object, you can directly pass it a fetch() call, and it will pass the response into the function when it fulfills.
The ResultObject's .instance property is then accessed, and the contained exported function invoked.
| WebAssembly JavaScript Interface # webassembly-namespace |
Enable JavaScript to view this browser compatibility table.
This page was last modified on Apr 22, 2025 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.