const myGlobal = new WebAssembly.Global({ value: "i32", mutable: false }, 42);
// 42
console.log(myGlobal.value);
// TypeError
myGlobal.value = 100;WebAssembly.Global.prototype.value / notebook
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.
const myGlobal = new WebAssembly.Global({ value: "i32", mutable: true }, 42);
// 42
console.log(myGlobal.value);
myGlobal.value = 100;
// 100
console.log(myGlobal.value);