I've done some porting between Python and JS based on Tensorflow in the past - and I suspect the poor ergonomics in JS for math/lists would probably ruin the experience a good amount.
Perhaps something like Pyodide can bridge the gap and make it easier to bring into the browser as well.