Global Variables and Constants
Learn how to use global variables and constants in WebAsemmbly.
We'll cover the following
The globals section is where we can import and export values in and out of WebAssembly modules. In a WebAssembly module, you can import either mutable or immutable values from JavaScript. Additionally, WebAssembly also supports wasmValue
, an internal immutable value inside the WebAssembly module itself.
Let’s create a file called globals.wat
and add the following contents to it:
Get hands-on with 1400+ tech skills courses.