A rather more modern physics engine for JS games can be found at https://rapier.rs/. It's written in Rust, compiled to WASM, works for 2D and 3D, and it's fast (well, fast for JS anyway).
has nightmare
You can implement a WASM runtime _in_ JavaScript (and people have done this, and it turned out to run so well that in some cases the performance hit was basically irrelevant), but that's because JS is Turing complete and any Turing complete system can emulate any other Turing complete system.