e01.org

WebAssembly.Global.prototype.valueOf()

The valueOf method of the WebAssembly.Global object prototype returns the value contained inside the global variable.

The **`valueOf`** method of the [`WebAssembly.Global`](/docs/WebAssembly/Reference/JavaScript_interface/Global) object prototype returns the value contained inside the global variable.

## Syntax

```js-nolint
valueOf()
```

### Parameters

None.

### Return value

A string indicating the value of the global.

## Examples

### Basic usage

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

// 42
console.log(myGlobal.valueOf());
```

## Specifications

## Browser compatibility

## See also

- [`global`](/docs/WebAssembly/Reference/Definitions/global) definition
- [WebAssembly](/docs/WebAssembly)

source: MDN Web Docs mirror · page

Cite this

"WebAssembly.Global.prototype.valueOf()". MDN Web Docs. CC BY-SA 2.5 (MDN). https://developer.mozilla.org/en-US/docs/WebAssembly/Reference/JavaScript_interface/Global/valueOf

JSON record · API collection · citation policy