It’s a workaround for the historical trash fire of JavaScript in the browser. Since nobody could agree on a way to do something other than JS in the browsers they came up with this gradual replacement where initially WebAssembly was just a special version of JS, then they turned that into a bytecode interpreter. The end goal was to let you use any language as your browser scripting language but the implementation isn’t there yet. It’s pretty painful to do anything with the browser APIs via WebAssembly because you’re still using the terrible JS APIs rather than something more ergonomic for the language you’re using and you need to write JS shims around all your non-JS code.
Basically it’s a start, but it falls short of what’s needed. Since you end up needing to write a bunch of JS anyway you’re mostly just creating more work for yourself rather than being able to avoid JS in the first place.
That said, by accident it’s also created something close to a universal bytecode since a very wide variety of languages support compiling to WebAssembly.
It’s a workaround for the historical trash fire of JavaScript in the browser. Since nobody could agree on a way to do something other than JS in the browsers they came up with this gradual replacement where initially WebAssembly was just a special version of JS, then they turned that into a bytecode interpreter. The end goal was to let you use any language as your browser scripting language but the implementation isn’t there yet. It’s pretty painful to do anything with the browser APIs via WebAssembly because you’re still using the terrible JS APIs rather than something more ergonomic for the language you’re using and you need to write JS shims around all your non-JS code.
Basically it’s a start, but it falls short of what’s needed. Since you end up needing to write a bunch of JS anyway you’re mostly just creating more work for yourself rather than being able to avoid JS in the first place.
That said, by accident it’s also created something close to a universal bytecode since a very wide variety of languages support compiling to WebAssembly.