Using the js-sys crate you can create a new Uint8Array (or Float32Array or whatever floats you boat) which will live on the JavaScript heap.
From there, you can use subarray() it to access sections of that array in the same way we might do &slice[start..end] in Rust. The to_vec(), copy_from(), and copy_to() methods can be used for efficiently copying bytes to/from the Uint8Array.