MDN self-hosted library · e01.org

WebAssembly.Global.prototype.value

Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.

js
const myGlobal = new WebAssembly.Global({ value: "i32", mutable: false }, 42);

// 42
console.log(myGlobal.value);

// TypeError
myGlobal.value = 100;
js
const myGlobal = new WebAssembly.Global({ value: "i32", mutable: true }, 42);

// 42
console.log(myGlobal.value);

myGlobal.value = 100;
// 100
console.log(myGlobal.value);