C++ reads and writes files with its own library. On the web they live in the module's file system, which JavaScript reaches too.
m.FS is that file system. main.js writes a file under /memfs, the folder kept in memory, and C++ then opens the same path with std::ifstream and std::ofstream, as it would on a disk.
A file under /memfs lasts as long as the page. A browser app that needs it after a reload writes under /opfs, which needs the Web Worker. On Node.js the same C++ opens real paths. Files has the details.
Try it
Append two more lines from JavaScript and count again.