Go follow the EMScripten Install Guide
Bascially the TLDR (on Windows):
git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
emsdk install latest
emsdk activate latest
emsdk_env.bat
cd ..\wasm
build.bat
npm i # or pnpm i
npm run watch
Open "wasm/hello.cpp"
Now go to "dist/preview.html" and right click "Show Preview"
Edit some of the hello.cpp and enjoy !
npm i # or pnpm i
npm run dev
Open in your browser : http://localhost:5173/
Interesting part is the "wasm/hello.cpp" file. Take a look at it !
Recommanded to read https://emscripten.org/docs/porting/connecting_cpp_and_javascript/Interacting-with-code.html to understand how the sdk is linked on JS