I’ve been wondering about this for a while and haven’t really found a great answer for it. From what I understand, WASM is:
Faster than JavaScript
Has a smaller file size
Can be compiled to from pretty much any programming language
Can be used outside of the browser easier thanks to WASI
So why aren’t most websites starting to try replacing (most) JS with WASM now that it’s supported by every major browser? The most compelling argument I heard is that WASM can’t manipulate the DOM and a lot of people don’t want to deal with gluing JS code to it, but aside from that, is there something I’m missing?
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person’s post makes sense in another community cross post into it.
Hope you enjoy the instance!
Follow the wormhole through a path of communities !webdev@programming.dev
I’ve ported games to web using WASM. You still need to interact with HTML DOM using JS, no way around it.
You use WASM when you either need raw CPU speed, or you have some C++ code that you don’t want to rewrite in JS.
If you just want to make a website, pure JS is better, unless you’re that kind of dev who prefers to render their own text strings pixel by pixel.