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 March 2020.
A WebAssembly.Global object represents 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.
Creates a new Global object.
All Global instances inherit from the Global() constructor's prototype object — this can be modified to affect all Global instances.
The value contained inside the global variable. This can be used to directly set and get the global's value.
Global.prototype.constructorReturns the function that created this object's instance. By default this is the WebAssembly.Global() constructor.
Global.prototype[Symbol.toStringTag]The initial value of the [Symbol.toStringTag] property is the String value "WebAssembly.Global".
Returns the value contained inside the global variable.
The following example shows a new global instance being created using the WebAssembly.Global() constructor. It is being defined as a mutable i32 type, with a value of 0.
The value of the global is then changed, first to 42 using the Global.value property, and then to 43 using the incGlobal() function exported out of the global.wasm module (this adds 1 to whatever value is given to it and then returns the new value).
Note: You can see the example running live on GitHub; see also the source code.
| WebAssembly JavaScript Interface # globals |
Enable JavaScript to view this browser compatibility table.
This page was last modified on Apr 27, 2026 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.