The value property of the WebAssembly.Global object prototype returns the value contained inside the global variable.
A string indicating the value of the global.
The value property of a Global object instance allows you to directly get or set the global's value.
For the setter to work, the global must be mutable (the mutable option was set to true when it was declared). If this is not the case, a TypeError exception is thrown.
const myGlobal = new WebAssembly.Global({ value: "i32", mutable: false }, 42);
// 42
console.log(myGlobal.value);
// TypeError
myGlobal.value = 100;const myGlobal = new WebAssembly.Global({ value: "i32", mutable: true }, 42);
// 42
console.log(myGlobal.value);
myGlobal.value = 100;
// 100
console.log(myGlobal.value);global definition