We use an offset exporting function to get the address of a string in WebAssembly memory. We then create a typed array on top of the WebAssembly memory representing the raw string data, and decode that into a JavaScript string.
WASM Fiddle: https://wasdk.github.io/WasmFiddle/?6wzgh
Demo Repo: https://github.com/guybedford/wasm-intro